What is the best way to support various 'standard' platforms with a single C++11 binary? This binary uses a handful of third party libraries including boost, zlib, xml2, openssl (all of which I can build statically).
The binary must run on a variety of Linux platforms for x86_64: Ubuntu 16.04 and 14.04, Centos 7.2 and Debian. Soon it must run on Darwin x86_64 and Ubuntu 16.04 on a Beagle Bone Black.
The default versions of compilers, libstdc++ and libc runtimes vary quite a bit on these platforms. I have had some Linux success building on Ubuntu 14.04 with an upgraded (toolchain r-test) g++ 5.3 compiler using these compiler options (note not using the "-static" switch):
-static-libstdc++ -static-libgcc -D_GLIBCXX_USE_CXX11_ABI=0
However, this requires installing the upgraded 5.3 compiler on the host (default is 4.9 IIRC) and some runtime libs on the target platforms which is not preferred and risks issues with libc.so. If it should be determined that this sort of solution is best, then I would prefer to build on 16.04 with the newest g++ or clang with switches so the binary runs on older platforms with minimal changes to defaults. Yes, I know I am perhaps asking for the moon :)
I was also considering an attempt to use musl to create a 'more static' binary. I could also consider using clang (ugh: but with similar upgrades beyond the distro defaults?) but I have no experience there.
Anyone with experience/recommendations? I would very much like to avoid maintaining separate compilations and combinations of third-party libs and compilers and settings and upgrades for each platform.
Using the same version of the same compiler and possibly the same version of a libc would be best but may not be possible: clang with musl?
Thanks
Aucun commentaire:
Enregistrer un commentaire