[tlbuild] Static linking of C++ runtime library causing problems on x86_64-cygwin

Peter Breitenlohner peb at mppmu.mpg.de
Thu Feb 20 10:04:24 CET 2014


On Wed, 19 Feb 2014, Ken Brown wrote:

> #endif]],
>                                      [[cout <<"worksok\n";]])])
>   case $host in
> -  *cygwin*)  flags_try0='-static -static-libgcc';
> -             flags_try1='-lstdc++'; flags_try2=$flags_try1;;
> +  *cygwin*)  flags_try0='-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic';;
>   *)  flags_try0='-nodefaultlibs -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm'
>       flags_try1='-lgcc_eh -lgcc -lc -lgcc_eh -lgcc'
>       flags_try2='-lgcc -lc -lgcc';;

Hi Ken,

applied (r33005).

> Everything built fine on both x86 and x86_64 [*].  So if other platforms 
> really need the -nodefaultlibs flag, then I guess Cygwin will still have to 
> be a special case, unless you can find some other way of getting around this. 
> But at least it's not a special case that causes problems with other parts of 
> the build

the -nodefaultlibs flag is certainly needed for Linux and perhaps as well
for others.  Linking without this flag amounts to
   -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lstdc++ ...
where the first libstc++.a resolves the references, but the second
libstc++.so still gets recoded in the binary as runtime requirement and this
may cause problems.  That is different for Cygwin where libstc++.dll.a finds
nothing to resolve and is effectively ignored.

Regards
Peter



More information about the tlbuild mailing list