tttapa / docker-arm-cross-toolchain

Modern GCC cross-compilation toolchains for Raspberry Pi
https://tttapa.github.io/Pages/Raspberry-Pi
MIT License
80 stars 15 forks source link

Possible to downgrade GLIBCXX ? #5

Open mgautierfr opened 1 year ago

mgautierfr commented 1 year ago

We have a library build with your toolchain which is used in python packages.

Those packages are checked with auditwheel and the check fails as there is to new symbol found.

After investigation, auditwheel accept only GLIBCXX up to 3.4.24 (source) and we have GLIBCXX 3.4.26 and 3.4.29 in our lib.

It is possible to downgrade stdlibc++ (g++?) to stay under 3.4.24 ?

tttapa commented 1 year ago

No, this is not possible. Newer versions of GCC simply require newer versions GLIBCXX. You can find an overview of the different versions here: https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html

One option I use for my Python packages is to link libstdc++ statically (using GCC's -static-libstdc++ flag). This increases the binary size slightly, but this is worth it in my eyes.

If you don't want to link libstdc++ statically, you'll have to downgrade GCC itself, which you can do in the crosstool-ng config. This does of course imply that you will not be able to use any C++20 or C++23 features, and even some C++17 features will be unsupported, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017 for details.

With some linker script magic, it might be possible to only statically link functions with newer GLIBCXX versions, but this is not something I looked into yet, and combining static and dynamic versions of libstdc++ functions might have unintended consequences.

mgautierfr commented 1 year ago

Ok. Thanks for your answer.

We will revert on our side to the previous toolschain. It will be far more simpler for us. (but I keep the static-libstdc++ in mind) We will move back to this toolschain once our oldest platform will be updated.