Intend to add an alternative root
this allow to develloper to use/execute binaries built until a libc 2.36.1
it create an /opt/sysroot where new sysroot is set
readlef / patchelf are added to NAS $PATH
To build an executable that will work with the new glibc, do this:
g++ main.o -o myapp … \
-Wl,–rpath=/opt/sysroot/lib \
-Wl,–dynamic-linker=//opt/sysroot/lib/ld-linux.so.2
The -rpath linker option will make the runtime loader search for libraries in /opt/sysroot/libc (so you wouldn’t have to set LD_LIBRARY_PATH before running it), and the -dynamic-linker option will “bake” path to correct ld-linux.so.2 into the application.
./patchelf –set-interpreter /opt/sysroot/lib/ld-linux.so.2 –set-rpath /opt/sysroot/lib myapp
When you try to run a binary in linux, the binary tries to load the linker, then the libraries, and they should all be in the path and/or in the right place. If your problem is with the linker and you want to find out which path your binary is looking for, you can find out with this command:
$ readelf -l myapp | grep interpreter
[Requesting program interpreter: /lib/ld-linux.so.2]
If your problem is with the libs, commands that will give you the libs being used are:
$ readelf -d myapp | grep Shared
$ ldd myapp
Versions available for download:
- TS-NASX86
- TS-NASARM_64
- TS-X41
- TS-X31P2
- TS-X31
Last update: 20 November 2022
Reviews
There are no reviews yet.