When I compile with ./gcc-arm-linux-gnueabihf-4.7-master/bin/arm-linux-gnueabihf-g++ -c Steph.cpp on an Ubuntu Linux 16.04 machine which already has gcc 5.3.1 installed:

I get the error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

even though I specify what the LD_LIBRARY_PATH is. Using strace, I verified that the libstdc++.so.6 at LD_LIBRARY_PATH is recognized and read.

I am using the GitHub download of gcc-arm-linux-gnueabihf-4.7-master. Does it have an install script which I forgot to do?

How do I fix this error?

The reason I ask this question is I want to cross compile with an ARMv6 forward compatible comilper a simple example using a shared library which is scheduled for testing on an Raspberry PI ARMV6 emulator Wheezy mounted on a SD card.

Earlier today I compiled the same simple example on an ARMv7 compiler, arm-linux-gnueabihf-g++ version 5.3.1 installed on the same Ubuntu Linux computer hosting a Raspberry PI arm v6 emulator installed on SD card mounted in an USB adapter and got Segmentation Fault when I ran this simple ARMV7 example's executable on this particular emulator.

  • @goldilocks, Thanks for the great edit. Could I ask you how to fix the following error messages: ./Downloads/tmp/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lgcc_s and Downloads/tmp/usr/bin/../lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lgcc Do these errors have anything to do with collect2 and bash shell export LD_LIBRARY_PATH? – Frank May 4 '16 at 14:23
  • I enjoy cross-compiling anything beyond the kernel about as much as I enjoy cross-country running, which is very little but I'll do it when I have to -- so I'm not much help with this. I hope you understand the reason for the edit was "my problem is urgent" is a general no-no on SE. I would try and get a preliminary clue or answer about this on S.O., keeping in mind normal pi images seem to have a bit of weird thing going on with paths and core library bits (which makes the kernel easy, because it is statically linked). – goldilocks May 4 '16 at 14:32
  • @goldilocks, Thanks for your reply a few minutes ago. I will post another question about this subject now. – Frank May 4 '16 at 14:44
  • I found out through trial and error that cannot find -lgcc can be fixed using --sysroot=file_path where libgcc.so can be found in the file_path. However -lgcc_s appears not to be sensitive to --sysroot. Does anyone now how to fix cannot find -lgcc_s? Thank you. – Frank May 4 '16 at 19:21
  • @goldilocks, Here is the new question you suggested I ask earlier this morning. raspberrypi.stackexchange.com/questions/46878/… – Frank May 4 '16 at 22:49

There is most likely a bug in linaro 4.7 about LD_LIBRARY_PATH. Instead, I used this link, http://packages.ubuntu.com/precise/amd64/g++-4.6-arm-linux-gnueabihf to solve the cannot load shared object libstdc++.so.6, no such file bug.

  • Could a knowledgeable person tell me the installation steps for packages.ubuntu.com/precise/amd64/g++-4.6-arm-linux-gnueabihf? Thank you. – Frank May 4 '16 at 15:23
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Dec 17 '19 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.