This post shows how to load custom shared libraries for a given executable on a Linux system.

An attempt to run the Linux version of the Nuclear Thorne on an up-to-date Arch Linux system produces the following error message.

$ ./runner 
./runner: error while loading shared libraries: cannot open shared object file: No such file or directory

A quick investigation reveals that the missing shared library belongs to the openssl package

$ pacman -Qo /usr/lib/
/usr/lib/ is owned by openssl 1.1.0.e-1

The executable runner we are trying to run depends on an earlier version of openssl. This can be easly seen from the output of the ldd command:

$ ldd runner (0xf7726000) => /usr/lib32/ (0xf755e000)
[...] => not found => not found

Obviously, it wouldn’t be wise to downgrade the openssl package. However, it is possible to provide the shared library loader with a list of custom .so files using the LD_PRELOAD variable.

In my case this simple call solves the problem:

LD_PRELOAD=/home/julian/install/nuclearthrone/usr/lib32/ ./runner

The LD_PRELOAD list must contain absolute paths since the original runner executable can call another executable sitting in some directory different from the current.