bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib-tool: Fix link errors with a particular set of modules on min


From: Simon Josefsson
Subject: Re: gnulib-tool: Fix link errors with a particular set of modules on mingw
Date: Sat, 07 Nov 2020 14:03:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Bruno Haible <bruno@clisp.org> writes:

> A testdir created by this command:
>
> ./gnulib-tool --create-testdir --dir=../testdir --single-configure clean-temp 
> crypto/gc getaddrinfo getlogin getlogin_r gettimeofday isatty link localename 
> opendir physmem poll putenv read readdir relocatable-prog rename rewinddir 
> select sethostname socket stat fstat tmpdir tmpfile uname utime write cond 
> lock
>
> produces link errors on mingw, regarding symbols such as rpl_malloc, 
> rpl_strdup,
> etc., all found in the generated gllib/libgnu.a.
>
> This patch fixes it.

Hi Bruno.  Your patch caused build failures [1] for OATH Toolkit:

/bin/bash ../../libtool  --tag=CC --preserve-dup-deps  --mode=link gcc  -g -O2  
 -o test-version-etc test-version-etc.o libtests.a ../../gl/libgnu.la 
libtests.a ../../gl/libgnu.la
libtool: link: gcc -g -O2 -o test-version-etc test-version-etc.o  libtests.a 
libtests.a ../../gl/.libs/libgnu.a
/usr/bin/ld: ../../gl/.libs/libgnu.a(version-etc.o): in function 
`version_etc_arn':
/home/jas/src/oath-toolkit/oathtool/gl/version-etc.c:83: undefined reference to 
`version_etc_copyright'
collect2: error: ld returned 1 exit status

OATH Toolkit uses version-etc but not version-etc-fsf.  The test for
version-etc pulls in version-etc-fsf into libtests.  Removing the final
../../gl/libgnu.la (reverting the effects of your patch) from the
command line fixes the above link error.

Gnulib-tool says:

  if $use_libtests; then
    # All test programs need to be linked with libtests.a.
    # It needs to be passed to the linker before ${libname}.${libext}, since
    # the tests-related modules depend on the main modules.
    # It also needs to be passed to the linker after ${libname}.${libext}
    # because the latter might contain incomplete modules (such as the 'error'
    # module whose dependency to 'progname' is voluntarily omitted).
    # The LIBTESTS_LIBDEPS can be passed to the linker once or twice, it does
    # not matter.
    echo "LDADD = libtests.a 
${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} libtests.a 
${testsbase_inverse}/${sourcebase-lib}/${libname}.${libext} 
\$(LIBTESTS_LIBDEPS)"

The comment explains why libtests has to be BEFORE and AFTER libgnu.la
but not why libgnu.la has to be AFTER libtests.  Your patch introduced
this -- could the comment be improved explaining the reason?

What is the solution here?  Adding yet another occurance of libtests.a
after the second libgnu.la?  That also fixes it for me.  Would that fix
break your mingw command?  I don't have mingw setup for testing right
now.

Thanks,
/Simon

[1] https://gitlab.com/oath-toolkit/oath-toolkit/-/jobs/836117891

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]