This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

gcc sensitive to order of -L and -l switches


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.


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