0

I get 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-g‌​nueabihf/bin/ld: cannot find -lgcc when I compile a C++ source file on an Ubuntu Linux 16.04 machine using the C++ ARMv6 compiler, arm-linux-gnueabihf-g++-4.6.

  • Please let me caution the reader that I downloaded this compiler rather than installing it with something like sudo apt-get install arm-linux-gnueabihf-g++. *

    Do these errors have anything to do with arm-linux-gnueabihf-g++-4.6 --sysroot or the fact that strace shows collect2's runtime filepath is not resolved or an incorrect bash shell export LD_LIBRARY_PATH? Or, could these errors be caused by another source?

    We are using the arm-linux-gnueabihf-g++-4.6 compiler to cross-compile source files for the Raspberry PI ARM v6 emulator mounted on an SD Card and as a linker for generating executables which load shared objects.

    Please recommend a way to solve the above 2 error messages.

    Any help is greatly appreciated.

2
  • I tried statically linking libgcc_s.a and lbgcc.a with no success.
    – Frank
    May 4, 2016 at 22:46
  • @goldilocks, Here is the new Raspberry PI stack exchange question you recommended I ask earlier this morning.
    – Frank
    May 4, 2016 at 22:48

1 Answer 1

0

I fixed this problem by prefacing -ltestconverter by -L. in the arm-linux-gnueabihf-g++-4.6 linking step.

But now I am getting multiple definitions errors when I run this linking step:

/home/Downloads/tmp/usr/bin/arm-linux-gnueabihf-g++-4.6 -g  --sysroot=.  Test.o  -o SimpleTester -shared -L. -ltestconverter

./testconverter.so:(.data+0x0): multiple definition of `__dso_handle'
crtbeginS.o:(.data.rel.local+0x0): first defined here
./testconverter.so: In function `_init':
:(.init+0x0): multiple definition of `_init'
crti.o:(.init+0x0): first defined here
./testconverter.so: In function `_fini':
:(.fini+0x0): multiple definition of `_fini'
crti.o:(.fini+0x0): first defined here
crtendS.o:(.tm_clone_table+0x0): multiple definition of `__TMC_END__'
./testconverter.so::(.data+0x4): first defined here

How do I fix this problem? Thank you.

2
  • I fixed this problem by using an g++-4.6 vintage loader(ld) instead of the arm-linux-gnueabihf-g++-4.6 compiler and linker. Then, I removed all the loader references to object files and libraries such as crti.o and -lgcc_s.
    – Frank
    May 5, 2016 at 11:33
  • 2
    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 20, 2019 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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