Resolving library version incompatibility for on recent Ubuntu versions

On an x86_64 computer running Ubuntu 22.04 (and, I think, earlier releases too) the version of in /usr/lib/x86_64-linux-gnu/ is Julia, even when compiled from sources, provides ./usr/lib/ The result is that operations like pre-compiling the GLMakie package fail with obscure error messages. Also certain R or Python packages that incorporate compiled C++ code fail inside of RCall or PyCall, again with error messages that may puzzle new users.

I have used two different fixes, both of which seem a bit hackish. One is brute force - changing the symbolic links in the julia sources ./usr/lib directory for and to point to the system version,, instead of the local version, An alternative, which I saw in Miguel Raz Guzmán Macedo’s JuliaCon workshop on the REPL is to call Julia as

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/ julia

Is there a recommended way of overriding the version of that is shipped with Julia?

After discussing this with @ararslan, I think the Make flag to set would be USE_SYSTEM_LIBSTDCXX, but it doesn’t seem to exist. It might be worth a PR adding it.

Related: GLIBCXX version not found