[ELDK] arm-linux-gnueabi/4.6.4/ld: cannot find -lc

Wolfgang Denk wd at denx.de
Mon Jul 2 14:04:12 CEST 2012


Dear uc freak,

In message <CAJUUqabVpg5X9f9ppE3aqEnot65kpARbyn1xJ6xf3Kq=8PUJ9w at mail.gmail.com> you wrote:
>
> Then I tried to generate a small c application (hello.c) :

Ok, but I bet this was not really the code you used.  Because it would
not compile:

> #include <stdio.h>
> #include <stdlib.h>
> 
> main (int ac, char **av)
> 
> {
>                 while (1) {
>                                 printf ("hello\n");
>                                 sleep (1)

There is a semicolon missing after this statement.

>                 }
> }
> 
> 
> Compilation, static:
> 
> > arm-linux-gnueabi-gcc -static -o hello hello.c
> 
> 
> Error message:
> 
> /opt/eldk-5.2.1/armv4t/sysroots/i686-eldk-linux/usr/libexec/armv4t-linux-gnueabi/gcc/arm-linux-gnueabi/4.6.4/ld:
> cannot find -lc
> collect2: ld returned 1 exit status
> 
> I suspect maybe a problem with the libc, but this domain is pretty new to
> me.

Did you try building the same problem (after fixing the missing
semicolon) on your host system, using the normal host compiler.  This
is what I get for example on ax86_64 box running Fedora 17:

	-> gcc -static -o hello hello.c
	/bin/ld: cannot find -lc
	collect2: error: ld returned 1 exit status

> Any idea where to look at?

Just omit the "-static" part.  Actually static linking is not really
supported in Linux; see for example the GNU libc FAQ:

http://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F

This is not a deficiency in ELDK, it is a more general issue.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There are two ways to write error-free programs. Only the  third  one
works.


More information about the eldk mailing list