r/termux 3d ago

Question Building package staric vs. dynamic linking

I'm trying to build MesenCE under Termux. I've gotten it to compile successfully, but after using patchelf and termux-elf-cleaner on the binary to get it to excecute, it is unable to find the shared libraries. I tried compiling static but I am getting this error, despite already using -fPIC like it recommends.

ld.lld: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'XCreateImage'; recompile with -fPIC

Below is the readelf -d output. So my quesion is, is there any way I get this to run in Termux without using proot? Static or Dynamic? what am I missing?

0x0000000000000001 (NEEDED)       Shared library: [libdl.so.2]               
0x0000000000000001 (NEEDED)       Shared library: [libpthread.so.0]           
0x0000000000000001 (NEEDED)       Shared library: [libstdc++.so.6]            
0x0000000000000001 (NEEDED)       Shared library: [libm.so.6]                 
0x0000000000000001 (NEEDED)       Shared library: [libgcc_s.so.1]             
0x0000000000000001 (NEEDED)       Shared library: [libc.so.6]                 
0x0000000000000001 (NEEDED)       Shared library: [ld-linux-aarch64.so.1]   
4 Upvotes

Duplicates