This is the mail archive of the gcc-help@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]

Problem with modifying LDFLAGS in Makefile


I want to run make on the following Makefile:

.SUFFIXES: .pl .cmp
LDFLAGS= -lm # -O2
CFLAGS= -O2 # -O2 -g  -pg -f68881
CC= gcc
OBJECTS= main.o plg.o command.o init.o hash.o func.o set.o \
         item.o list.o utils.o alloc.o terms.o clause.o lib.o \
         integrat.o cost.o bits.o reduce.o sat.o sample.o \
         interp.o deduce.o xy.o subsume.o chi.o
SOURCE= main.c plg.c command.c init.c hash.c func.c set.c \
         item.c list.c utils.c alloc.c terms.c clause.c lib.c \
         integrat.c cost.c bits.c reduce.c sat.c sample.c \
         interp.c deduce.c xy.c subsume.c chi.c

progol: $(OBJECTS)
         $(CC) $(CFLAGS) $(OBJECTS) -o progol $(LDFLAGS)
mem:
         touch item.c init.c plg.c
         make progol
count:
         wc $(SOURCE)
clean:
          -rm -f *.o

I have installed GCC under Linux 2.2.12 using the RPM 
egcs-1.1.2-24.i386.rpm, and this has placed the "include" subdirectory at 
/usr/i386-glibc20-linux/include and the "lib" subdirectory at 
/usr/i386-glibc20-linux/lib. In order to have access to these 
subdirectories via the Makefile, I have made the following changes to 
LDFLAGS and CFLAGS:
    LDFLAGS= -lm -L/usr/i386-glibc20-linux/lib # -O2
    CFLAGS= -O2 -I/usr/i386-glibc20-linux/include # -O2 -g  -pg -f68881

The modification to CFLAGS has enabled compilation of the OBJECTS to 
proceed successfully, but I am still getting the linker error message
    /usr/bin/ld: cannot open crt1.o: No such file or directory
    collect2: ld returned 1 exit status
even though crt1.o is located in /usr/i386-glibc20-linux/lib

How do I modify the Makefile to enable the linker to proceed?

Richard

BTW: What does  #  in LDFLAGS and CFLAGS mean? I cannot find a definition 
for it in any of my C/C++/Linux textbooks.
-------------------------------
Richard Dybowski, 143 Village Way, Pinner, Middlesex  HA5 5AA, UK
Tel (mobile): 079 76 25 00 92


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