0
votes

My system is: Kubuntu Linux ubuntu 3.8.0-23-generic #34-Ubuntu SMP Wed May 29 20:24:54 UTC 2013 i686 i686 i686 GNU/Linux

I am trying to run this command:

ld -o loader loader.o startup.o start.o -lc -T linking_script -dynamic-linker /lib/ld-linux.so.2

and I am getting the following error:

ld: cannot find -lc

I also tried this: sudo yum install glibc-static But got this error and couldn't find a way to add the repo's to it: There are no enabled repos.

Hope you can help me.

2
Why don't you link with the gcc command? - Basile Starynkevitch

2 Answers

1
votes

Check LIBRARY_PATH env variable.

Try adding -L<Library Directory>.

0
votes

The man page for ld suggests that it has the following syntax:

ld [options] objfile ...

So, you need to put all options before the files. For example:

ld -o loader -lc -T linking_script -dynamic-linker /lib/ld-linux.so.2 loader.o startup.o start.o