This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libtool 2.2.6a: LDFLAGS ignored when building a shared lib?


Hi Chuck,

I have a problem using libtool 2.2.6a.  I've just tried to build the
latest file(1) for Cygwin 1.7 using gcc-4.  Since gcc-4 is still in flux
I decided to build with a static libgcc.  First I reconfed the file
source tree so that the latest libtool is used.  This worked fine,
configure and make succeeded.  However, here's the one puzzeling problem
I have.  I'm unable to build using the -static-libgcc flag.  I tried to
add it to LDFLAGS, then to CFLAGS, then to both.  For some reason this
flag is filtered out when gcc gets called to link the shared lib.

To prove that I'm using libtool 2.2.6a:

$ grep '^macro_' ../libtool
macro_version=2.2.6
macro_revision=1.3012

This is what you find in Makefile:

libmagic_la_LDFLAGS = -no-undefined -version-info 1:0:0
[...]
libmagic_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
	$(libmagic_la_LDFLAGS) $(LDFLAGS) -o $@

And that's what happens when calling make:

$ make CFLAGS='-g -O2 -static-libgcc' LDFLAGS=-static-libgcc
[...]
/bin/sh ../libtool --tag=CC   --mode=link gcc -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith        -Wmissing-declarations -Wredundant-decls -Wnested-externs        -Wsign-compare -Wreturn-type -Wswitch -Wshadow        -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -g -O2 -static-libgcc -no-undefined -version-info 1:0:0 -static-libgcc -o libmagic.la -rpath /usr/lib magic.lo apprentice.lo softmagic.lo ascmagic.lo encoding.lo compress.lo is_tar.lo readelf.lo print.lo fsmagic.lo funcs.lo apptype.lo cdf.lo cdf_time.lo readcdf.lo  -lz 
libtool: link: rm -fr  .libs/libmagic.a .libs/libmagic.dll.a .libs/libmagic.la . libs/libmagic.lai
libtool: link: gcc -shared  .libs/magic.o .libs/apprentice.o .libs/softmagic.o .  libs/ascmagic.o .libs/encoding.o .libs/compress.o .libs/is_tar.o .libs/readelf.o .libs/print.o .libs/fsmagic.o .libs/funcs.o .libs/apptype.o .libs/cdf.o .libs/cdf_time.o .libs/readcdf.o   -lz    -o .libs/cygmagic-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libmagic.dll.a

So there's the `-static-libgcc' twice in the libtool comamnd line when
called from make.  But when libtool calls gcc, nothing's left of it.  I
understand why CFLAGS is missing, but why did it filter out LDFLAGS as
well?  And, if that's normal, why, and how do I workaround that?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]