Rainer Deyke wrote:
I am trying to produce portable binaries while using modern C++, so my policy is this: - Compile on a Docker image with an older OS installed (currently Ubuntu 16.04 LTS) so that I can link to an older libc. - Build my own compiler (currently gcc 13.2.0) instead of relying on the OS package manager. This means libraries are installed in /usr/local/lib64 instead of /usr/lib. - Statically link everything except libc, including libstdc++ (by setting CXXFLAGS=-static-libstdc++). - Deliberately don't point LD_LIBRARY_PATH to /usr/local/lib64, because these libraries won't exist on the target system and should only be statically linked.
The problem is that while tools/build/src/engine/build.sh respects CXXFLAGS, bootstrap.sh deliberately clobbers CXXFLAGS from the environment, so b2 is built dynamically linked to a version of libstdc++ that it can't find at runtime.
You should use the --cxxflags option.