1

I wanna cross compile a software for an ARM target running on Linaro 14.04.

When I cross compile from my Ubuntu 18.04 using arm-linux-gnueabihf-g++, and I try to run it on target, I obtain this error :

./main: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./main)

./main: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./main)

My problem is that I can't upgrade any library on target.

So my question is, can I specify a specific version of GLIBC and CABI at the compilation time ?

Thanks a lot

MSalters
  • 173,980
  • 10
  • 155
  • 350
Furlings
  • 71
  • 1
  • 10

1 Answers1

2

You'll need to find a compiler of the same version as the target's libstdc++ was part of.

These ABI versions sometimes (not always) increase when new symbols are added to libstdc++.

Your best bet is in any case always to install the same OS version on your build machine. That is guaranteed to have the same toolchain version (although cross-compilers might differ there slightly).

Old answer follows. There is no package for GCC-4 so you'll have to install an older Ubuntu version.


It seems Ubuntu 18.04 has several GCC versions: https://packages.ubuntu.com/search?keywords=arm-linux-gnueabihf&searchon=names&suite=bionic&section=all

I'd try the newest one that works for your target. You can also compare the so version of libstdc++.so.X.Y.Z and make sure you use a GCC version with libstdc++ so version of maximum the one on your target machine.

If you're curious, the file defining these symbol versions can be found here: https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/config/abi/pre/gnu.ver.

Looking further in that file, I found this commit: https://github.com/gcc-mirror/gcc/commit/c19175577e1cbf749590889441ad5dd03bb2c9d7 It adds the version of symbols you are missing, and Github marks this as being present in GCC 5. Unfortunately, Ubuntu 18.04 does not have a pre-5 GCC toolchain.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
  • Thank you for your explanations ! So I probably will install a Docker image base on Ubuntu 14.04 and install the toolchain on it – Furlings Feb 28 '19 at 14:20
  • And effectively, I tried with a different computer with arm-linux-gnueabihf-g++-4.8 installed on it and it works. But with V5.0, that does not work – Furlings Feb 28 '19 at 14:22