Linker error: /usr/bin/ld: cannot find -lgcc_s

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












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?









share|improve this question























  • EDIT: The original command is as posted in the edited question.
    – Alex
    Nov 13 '13 at 16:17










  • What does 'echo $PATH' say?
    – schaiba
    Nov 13 '13 at 16:39










  • I found the solution in the meantime, thanks for making your suggestion.
    – Alex
    Nov 13 '13 at 16:43










  • The given link for symlinks is broken.
    – Faheem Mitha
    May 29 '17 at 23:26














up vote
3
down vote

favorite












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?









share|improve this question























  • EDIT: The original command is as posted in the edited question.
    – Alex
    Nov 13 '13 at 16:17










  • What does 'echo $PATH' say?
    – schaiba
    Nov 13 '13 at 16:39










  • I found the solution in the meantime, thanks for making your suggestion.
    – Alex
    Nov 13 '13 at 16:43










  • The given link for symlinks is broken.
    – Faheem Mitha
    May 29 '17 at 23:26












up vote
3
down vote

favorite









up vote
3
down vote

favorite











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?









share|improve this question















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?






ubuntu gcc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '13 at 16:17

























asked Nov 13 '13 at 16:09









Alex

1,629154270




1,629154270











  • EDIT: The original command is as posted in the edited question.
    – Alex
    Nov 13 '13 at 16:17










  • What does 'echo $PATH' say?
    – schaiba
    Nov 13 '13 at 16:39










  • I found the solution in the meantime, thanks for making your suggestion.
    – Alex
    Nov 13 '13 at 16:43










  • The given link for symlinks is broken.
    – Faheem Mitha
    May 29 '17 at 23:26
















  • EDIT: The original command is as posted in the edited question.
    – Alex
    Nov 13 '13 at 16:17










  • What does 'echo $PATH' say?
    – schaiba
    Nov 13 '13 at 16:39










  • I found the solution in the meantime, thanks for making your suggestion.
    – Alex
    Nov 13 '13 at 16:43










  • The given link for symlinks is broken.
    – Faheem Mitha
    May 29 '17 at 23:26















EDIT: The original command is as posted in the edited question.
– Alex
Nov 13 '13 at 16:17




EDIT: The original command is as posted in the edited question.
– Alex
Nov 13 '13 at 16:17












What does 'echo $PATH' say?
– schaiba
Nov 13 '13 at 16:39




What does 'echo $PATH' say?
– schaiba
Nov 13 '13 at 16:39












I found the solution in the meantime, thanks for making your suggestion.
– Alex
Nov 13 '13 at 16:43




I found the solution in the meantime, thanks for making your suggestion.
– Alex
Nov 13 '13 at 16:43












The given link for symlinks is broken.
– Faheem Mitha
May 29 '17 at 23:26




The given link for symlinks is broken.
– Faheem Mitha
May 29 '17 at 23:26










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Solution: Omitting the option -N.






share|improve this answer
















  • 1




    Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things).
    – Anko
    Nov 13 '13 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.
    – Alex
    Nov 14 '13 at 6:44










  • @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.
    – Netch
    Aug 30 '14 at 6:16











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f101043%2flinker-error-usr-bin-ld-cannot-find-lgcc-s%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Solution: Omitting the option -N.






share|improve this answer
















  • 1




    Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things).
    – Anko
    Nov 13 '13 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.
    – Alex
    Nov 14 '13 at 6:44










  • @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.
    – Netch
    Aug 30 '14 at 6:16















up vote
0
down vote













Solution: Omitting the option -N.






share|improve this answer
















  • 1




    Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things).
    – Anko
    Nov 13 '13 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.
    – Alex
    Nov 14 '13 at 6:44










  • @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.
    – Netch
    Aug 30 '14 at 6:16













up vote
0
down vote










up vote
0
down vote









Solution: Omitting the option -N.






share|improve this answer












Solution: Omitting the option -N.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '13 at 16:42









Alex

1,629154270




1,629154270







  • 1




    Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things).
    – Anko
    Nov 13 '13 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.
    – Alex
    Nov 14 '13 at 6:44










  • @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.
    – Netch
    Aug 30 '14 at 6:16













  • 1




    Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things).
    – Anko
    Nov 13 '13 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.
    – Alex
    Nov 14 '13 at 6:44










  • @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.
    – Netch
    Aug 30 '14 at 6:16








1




1




Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things).
– Anko
Nov 13 '13 at 21:43




Why does this work? I can only figure out that man ld suggests -N disables linking against shared libraries (among many other things).
– Anko
Nov 13 '13 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.
– Alex
Nov 14 '13 at 6:44




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.
– Alex
Nov 14 '13 at 6:44












@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.
– Netch
Aug 30 '14 at 6:16





@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.
– Netch
Aug 30 '14 at 6:16


















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f101043%2flinker-error-usr-bin-ld-cannot-find-lgcc-s%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?