BinaryBuilder: what do I lose by using newer GCC?

The documentation for BinaryBuilder.jl says, “Generally speaking, we try to build with the as old as possible version of GCC (v4.8.5 being the oldest one currently available), for maximum compatibility.”

However, some libraries require newer GCC versions. In such cases, which users exactly will suffer compatibility problems when using the binary artefacts produced? For example, is there a list of Linux distributions that will suffer when supplied with binaries compiled by GCC6 instead of GCC4? And for users that are affected, will they get a warning when trying to install a JLL package, or will they encounter crashes at run time?

1 Like

Well, in that case you don’t have many options, do you? But the point is that you should try to use the oldest version of GCC which is able to compile the code.

There are multiple problems with GCC:

  • C++ code linking to libstdc++ embeds symbols named GLIBCXX_<ABI_VERSION>, where ABI_VERSION is the version of the libstdc++ ABI, so at runtime you must have a libstdc++ compatible with that ABI: this means that to be sure that most users will be able to actually run your code (if you care about that) then you must use an as old compiler as possible. Again, you also need to take into account what’s your package requirements: if for some reason your code requires GCC 8 then that’s going to be your baseline
  • for strictly C code you don’t have in principle similar ABI problems (the ABI depends on glibc, but that’s in general fixed), but on the other hand with each version of GCC we bundle a specific version of binutils and as a rule of thumb (but this isn’t strictly always the case) if you have linked a shared library with version X of GNU ld, then you’ll have to link downstream libraries which depend on that shared library with version Y of GNU ld, where Y >= X. You can see here that if you start using unnecessarily very recent versions of GCC (and hence GNU ld) for a package, then you’re forcing all downstream packages to be built with the same or newer versions of GCC, until you get to a C++ library where you run into the problem above. Just don’t do it: use the oldest GCC version possible and that’s it.

These, and more, problems are also mentioned in Yggdrasil/RootFS.md at a861e40958cdc1f45ed951d9fe416423934cd541 · JuliaPackaging/Yggdrasil · GitHub

1 Like