bug-libtool
[Top][All Lists]
Advanced

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

Re: Missing LDFLAGS in libtool


From: Ralf Wildenhues
Subject: Re: Missing LDFLAGS in libtool
Date: Sun, 9 Oct 2005 08:49:05 +0200
User-agent: Mutt/1.5.9i

Hi Neil,

* Neil Kirr wrote on Sat, Oct 08, 2005 at 07:40:58PM CEST:
> 
> I was trying to build libtool with a STATIC lib_gcc instead of the evil
> shared libgcc_s.so.  To my surprise I found that I had to edit this file in
> order for it to build the shared libraries with the --static-libgcc:
> 
> ../libtool-1.5.20/libltdl/libtool
> 
> I had to add the following to all of the lines with archive_cmds= and
> archive_expsym_cmds= (there were 6):
*snip*

> ADDED \$LDFLAGS:
> 
> archive_cmds="\$CC -shared \${wl}-h \${wl}\$soname -o \$lib \$libobjs
> \$deplibs \$compiler_flags \$LDFLAGS"
> archive_expsym_cmds="\$echo \\\"{ global:\\\" > \$lib.exp~cat
> \$export_symbols | \$SED -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >>
> \$lib.exp~\$echo \\\"local: *; };\\\" >> \$lib.exp~
>           \$CC -shared \${wl}-M \${wl}\$lib.exp \${wl}-h \${wl}\$soname -o
> \$lib \$libobjs \$deplibs \$compiler_flags~\$rm \$lib.exp \$LDFLAGS"
> 
> This correctly compiles using the --static-libgcc flag (assuming the user
> set their LDFLAGS environment variable).  This was on Solaris 9.

Thank you for the bug report.  This change is not correct, however.
Linker flags are supposed to be interpreted by `libtool', because it may
have to adjust (both itself and them).  Having LDFLAGS directly in
$archive_cmds is just wrong, as it bypasses this.

In this specific example, I would guess that the `postdeps' variable for
C++ will contain something like `-lstdc++ -lm -lgcc_s -lgcc_s', thus the
way above will break creating shared libraries.  This part should be
fixed by configuring with `-static-libgcc' already.  But there is
another bit to fix this completely: link mode then needs to accept the
flag, which it currently doesn't.

Can you try configuring libtool like this as a workaround 
  configure CXX='g++ -static-libgcc'

Does it work then (and not put `-lgcc_s' iN C++ postdeps)?
If so, I can try to come up with a proper fix.

By the way, GCC documentation has reasons to suggest using shared libgcc
over static for shared C++ libraries (but I guess you knew that).

Cheers,
Ralf




reply via email to

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