[Gc] Re: Link failure on Cygwin

Ludovic Courtès ludo at gnu.org
Thu Sep 17 14:38:36 PDT 2009


Ivan Maidanski <ivmai at mail.ru> writes:

> ludo at gnu.org (Ludovic CourtХs) wrote:

[...]

>> >> Linking libcord against libgc fails on Cygwin:
>> >> ...
>> >> *** Warning: This system can not link to static lib archive ./libgc.la.
>> >> *** I have the capability to make that library automatically link in when
>> >> *** you link to this library.  But I can only do this if you have a
>> >> *** shared version of the library, which you do not appear to have.
>> >> ...
>> >> See http://hydra.nixos.org/build/74624 for details.

[...]

> The problem is in the generated Makefile:
> THREADDLLIBS = -lpthread -ldl
>
> It works if changed to an empty list. Could anybody prepare the patch?

‘configure’ reads this:

--8<---------------cut here---------------start------------->8---
     *-*-cygwin*)
	AC_DEFINE(GC_WIN32_THREADS)
	AC_DEFINE(THREAD_LOCAL_ALLOC)
	win32_threads=true
	;;
--8<---------------cut here---------------end--------------->8---

That is, $THREADDLLIBS is already empty AIUI.

Furthermore, I don't see how it would fix this bit:

--8<---------------cut here---------------start------------->8---
/bin/sh ./libtool --tag=CC --mode=link gcc -fexceptions -I libatomic_ops/src -g -O2   -o libcord.la -rpath /nix/store/7x8whr8b6hkwi8m85r76fs9d4xg81mkk-boehm-gc-7.1/lib -version-info 1:3:0 -no-undefined cord/cordbscs.lo cord/cordprnt.lo cord/cordtest.lo cord/cordxtra.lo ./libgc.la 

*** Warning: This system can not link to static lib archive ./libgc.la.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
gcc -shared  cord/.libs/cordbscs.o cord/.libs/cordprnt.o cord/.libs/cordtest.o cord/.libs/cordxtra.o   -o .libs/cygcord-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libcord.dll.a
--8<---------------cut here---------------end--------------->8---

Note that ‘libtool’ is passed ‘./libgc.la’, which it discard from the
‘gcc -shared’ command line, leading to undefined references.

Thanks,
Ludo’.



More information about the Gc mailing list