delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/09/07:06:04

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 9 Feb 2009 13:05:43 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: libtool 2.2.6a: LDFLAGS ignored when building a shared lib?
Message-ID: <20090209120543.GD5416@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
MIME-Version: 1.0
User-Agent: Mutt/1.5.17 (2007-11-01)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019