0

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.

1
  • Why don't you link with the gcc command? Commented Jun 19, 2013 at 7:34

2 Answers 2

1

Check LIBRARY_PATH env variable.

Try adding -L<Library Directory>.

Sign up to request clarification or add additional context in comments.

2 Comments

LD_LIBRARY_PATH env variable is set up correctly. I have -lc Could you be more specific as to what I need to add. Thank you.
Sorry, it's LIBRARY_PATH, not LD_LIBRARY_PATH. And you may try something like "ld -L/usr/lib/x86-linux-gnu/ -o loader loader.o startup.o start.o -lc -T linking_script -dynamic-linker /lib/ld-linux.so.2" (-L add a directory to the search paths for libraries)
1

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 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.