Libcppyy_backend.so: cannot open shared object file: No such file or directory

OK, thanks for checking! That makes sense.

The ROOT (C++) installation generally doesn’t rely on DYLD_LIBRARY_PATH, but uses LC_RPATH. You should be able to start the root interpreter without using thisroot.sh and it will find its libraries.

The loader of cppyy backend, however, seems to try:

  1. The environment variable CPPYY_BACKEND_LIBRARY
  2. A “normal” dlopen where LD_LIBRARY_PATH or DYLD_LIBRARY_PATH are considered, and libraries in system locations are found.
  3. And finally it falls back to loading in the absolute path where loader.py is.

1 and 2 of course only work if the environment of your shell “survives”. There seems to be an error in 3., so I’ll bring this up with the cppyy maintainers.

So I guess you could use strategy 1. and 2., but you will have to change the shebang:

- #! /usr/bin/env python3
+ #! /usr/local/bin/python3

Or you can of course invoke it as python3 <script>.