[ECOS] trouble linking standard C libraries

Michael Anburaj embeddedeng@hotmail.com
Tue Mar 23 06:55:00 GMT 2004


This is not directly related to the eCOS forum, but I am sure I get the best 
answers here.

Standard library issue:

I tried the following on my linux box:

$ mipsisa3-elf-ld –o output hello.o

this gave unresolved reference errors on printf, memcpy & such standard lib 
(libc) functions. I thought the linker should include the libc by default 
when needed unless “no-sdtlibs” so something similar is specifies in the 
command-line. Am I right?

Then, I tried..

$ mipsisa3-elf-ld –o output hello.o –lc

It reported cannot find –lc

1. I thought the linker would know the path where standard libraries are 
stored & should automatically link-in when needed. But, I had to specify the 
library explicitly (using –lc) & also provide the library search path (using 
–L#path#). Are both these (-l & -L) required (a must) when working with 
standard C library functions? If yes, Please let me know how to specify the 
–L with relative path (so that it will work, no matter where the tool-chain 
was installed). If no ($ mipsisa3-elf-ld –o output hello.o – would produce 
the output), then what went wrong in my setup?
2. libc (-lc) or libgcc (-lgcc)? Which one should I include? What is the 
difference? Any document on them?

Please help me out on this.


MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://clk.atdmt.com/AVE/go/onm00200413ave/direct/01/

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list