Not able to link static library in makefie
Hi,
I want to link a static library which I created in my make file. I have copied the static library that I have created inside crosstool library path. I have tried it with -l[library-name] and -L [Library-Path] still getting problem can anyone solve this. Thanks, Jackson. |
Have you considered using $(AR). What is your makefile?
|
Yes I have used $(AR) my make file is:
CC=arm-linux-gcc CFLAGS+= -Wall AR=arm-linux-ar LIBS= ../lib REMOVE=rm SOURCE = posix_mqueue.c OBJS = posix_mqueue.o all: @echo Building Access Library @$(CC) -c $(CFLAGS) $(SOURCE) @$(AR) rcs libdepend.a $(OBJS) clean: @echo Cleaning Access Library @$(REMOVE) -f *.o Let me know if any other information needed. Thanks, Jackson. |
Make file looks fine, except that you need tabs for the commands below targets. I am not familiar with ARM compiler, but do you know what are 'rcs' and 'libdepend.a' ? I'd recommend to remove '@' in front of $(CC) and $(AR) to see exact commands being executed. What are the messages you are getting? And what are the output files in your directory?
|
After removing @ my makefile output is:
Building Access Library arm-linux-gcc -c -Wall posix_mqueue.c arm-linux-ar rcs libdepend.a posix_mqueue.o Only one output file I have posix_mqueue.o Thanks, Jackson. |
Could you please manually invoke archiver by typing in the command line:
> arm-linux-ar r mylib posix_mqueue.o And then check if it created library 'mylib'. Don't use 'cs' option, 'c' suppresses diagnostic messages, and 's' - just not necessary in this case. |
Hi,
Sorry for replying late. Still the problem persist. Thanks, Jackson. |
Please, remove posix_mqueue.o and run you make again. Then do "file posix_mqueue.o" and see what info it provides.
|
Hi,
It provided the following info: "posix_mqueue.o: ELF 32-bit LSB relocatable, ARM, version 1 (ARM), not stripped" Thanks, Jackson |
I am really stumped, there are no reasons for archive not to be created. May be problem with the tools? Are you confident in your tools? Try to experiment with 'arm-linux-ar'. See what option it has by typing 'arm-linux-ar --help'. Strange.... Should be very, very straight forward.
|
All times are GMT -5. The time now is 01:31 AM. |