Linux-app-wrapper
Linux-app-wrapper copied to clipboard
A way of using new libs on older systems
Hi. I've read your blog post and saw this program. It got me thinking, are we doomed to using old GCC if we want to make portable binaries ? I would think that GCC is getting better and better with each version and it probably generates (even if marginally) better code so I think that sucks. I thought I would try something else.
I've installed Ubuntu LTS 16 and 18 and copied my game to it with the following libs from my current Arch installation:
$ ls stdlibs/ -lh
total 5.4M
-rwxr-xr-x 1 oxi oxi 217K Feb 6 17:55 ld-linux-x86-64.so.2
-rwxr-xr-x 1 oxi oxi 2.1M Feb 6 17:51 libc.so.6
-rwxr-xr-x 1 oxi oxi 23K Feb 6 17:51 libdl.so.2
-rwxr-xr-x 1 oxi oxi 1.3M Feb 6 17:51 libm.so.6
-rwxr-xr-x 1 oxi oxi 151K Feb 6 17:51 libpthread.so.0
-rwxr-xr-x 1 oxi oxi 39K Feb 6 17:56 librt-2.33.so
lrwxrwxrwx 1 oxi oxi 15 Feb 6 17:57 librt.so -> ./librt-2.33.so
lrwxrwxrwx 1 oxi oxi 10 Feb 6 17:57 librt.so.1 -> ./librt.so
lrwxrwxrwx 1 oxi oxi 18 Feb 6 19:02 libSDL2-2.0.so -> ./libSDL2-2.0.so.0
lrwxrwxrwx 1 oxi oxi 23 Feb 6 19:01 libSDL2-2.0.so.0 -> ./libSDL2-2.0.so.0.18.2
-rwxr-xr-x 1 oxi oxi 1.7M Feb 6 19:01 libSDL2-2.0.so.0.18.2
Yes, even the dynamic linker. It is called instead of using the system linker like this
export LD_LIBRARY_PATH=./stdlibs/:$LD_LIBRARY_PATH
./stdlibs/ld-linux-x86-64.so.2 ./game.bin
And it just works(tm). What do you think of this approach ? Do you see anything that could go wrong with this ? I can see one thing already that is a pain with this. It's very hard to connect renderdoc to it since selecting the shell script will cause renderdoc to hook wrong PID and fail. I managed to run renderdoc with such setup only after replacing the system installed linker with my own copy (which was quite funny when for a while ls and cp stopped working when I moved the original file, but I managed :P)