5

I am trying to compile symlinks (tar.gz-file), which is a very small tool with one line for compilation:

gcc -Wall -Wstrict-prototypes -O2 -N -s -o symlinks symlinks.c 

which gives the error

.... /usr/bin/ld: cannot find -lgcc_s /usr/bin/ld: cannot find -lgcc_s collect2: ld returned 1 exit status 

The output of

/sbin/ldconfig -p | grep libgcc 

is

libgcc_s.so.1 (libc6) => /lib/i386-linux-gnu/libgcc_s.so.1 

and trying to include the mentioned directory directly

gcc -Wall -Wstrict-prototypes -L /lib/i386-linux-gnu/ -O2 -N -s -o symlinks symlinks.c 

produces the same error.

Three questions:

  1. Why does it not work with the first command, as the lib seems to be in the search path
  2. Why does including the path itself does not help
  3. How to fix this?
4
  • EDIT: The original command is as posted in the edited question. Commented Nov 13, 2013 at 16:17
  • What does 'echo $PATH' say? Commented Nov 13, 2013 at 16:39
  • I found the solution in the meantime, thanks for making your suggestion. Commented Nov 13, 2013 at 16:43
  • The given link for symlinks is broken. Commented May 29, 2017 at 23:26

1 Answer 1

0

Solution: Omitting the option -N.

3
  • 1
    Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things). Commented Nov 13, 2013 at 21:43
  • The version of gcc installed does not provide any help of -N on the man pages. Without deeper investigation I cannot say what -N does or did. Commented Nov 14, 2013 at 6:44
  • 2
    @Alex please don't mix gcc and ld flags. They are totally different. If you want static linking in gcc, use -static. Also you could be interesting in -static-libgcc. They are tons of undocumented gcc flags because it converts virtually all input flags to internal form before reprocessing, so don't surprise on unexpected result from undocumented flags. Commented Aug 30, 2014 at 6:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.