This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc sensitive to order of -L and -l switches
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: gcc sensitive to order of -L and -l switches
- From: Rok Papez <rok dot papez at kiss dot uni-lj dot si>
- Date: Tue, 16 Nov 1999 10:22:24 +0100
- Reply-To: rok dot papez at kiss dot uni-lj dot si
Hi!
gcc (egcs-2.91.66 Redhat6.0 linux) is sensitive to order of -L and -l switches.
Since GNU make ( 3.77) calls gcc for linking first with source and target and
*after* that with LDFLAGS, this *is* a problem.
------- Stripped down version of Makefile --------------------
#Makefile for httpdial
CC=gcc
CFLAGS:=-I../iflib -I../httplib
LDFLAGS=-L../iflib -L../httplib -lif -lhttp -lpthread
CFLAGS:=$(CFLAGS) -g -DDEBUG
all: httpdial
httpdial.o:\
httpdial.h\
httpdial.c
syslog.o:\
syslog.h\
syslog.c
httpdial:\
httpdial.o\
syslog.o
----------------------------------------------------
make issues the following call for linking:
gcc -L../iflib -L../httplib -lif -lhttp -lpthread httpdial.o -o httpdial
that fails becouse gcc refuses to link with the given libraries.
But manualy running linking with:
gcc httpdial.o -o httpdial -L../iflib -L../httplib -lif -lhttp -lpthread
works like a charm.
If thih is a known/fixed issue I'm sorry.. I did read the info pages on
bugs, etc. I have also contacted the GNU make m.l. and issued a bug report with
them.
As I'm not subscribed to the list, send any replies/queries to my personal
mailbox, thank you.
--
best regards,
Rok Papez.