This project depends on NixOS's patchelf >>>
Combining linux executable programs and dependent dynamic link libraries.
After using this program, you can port CentOS 8 programs to CentOS 7 for execution. In theory, you can even port them to Ubuntu and other systems.
- Recursive analyze
- Support folder analyze
- Solve the problem of ld-linux-x86-64.so.2 dependency
First, put your application to a directory, like /root/x64:
Then, download and uncompress patchelf-recurse.tar.gz to /root directory:
wget https://www.javaai.org/uploads/file/20240607/1717772613420044993.gz -O patchelf-recurse.tar.gz
tar -zxvf patchelf-recurse.tar.gz
Use patchelf-recurse.sh to combine executable application and dynamic libs:
./patchelf-recurse/patchelf-recurse.sh x64
After this, you can see all dynamic lib references become reletive path(looks like absolute path, but actually is reletive path, ldd command will parse reletive path to absolute path for display):
ldd x64/searchd
Copy your application to target machine, and then use the following commands to repaire intepreter:
./patchelf-recurse/patchelf-repaire-ld-linux.sh x64
You muse execute this command on target machine, because interpreter always be absolute path, after you done, you will see the elf file's interpreter becomes absolute path:
Every time you change the application's directory, you must execute patchelf-repaire-ld-linux.sh again, because elf file's interpreter path always be absolute.Enjoy your repaired standalone application: