Issue
I am trying to build a C ELF binary on linux and try to execute it directly on another machine. (Sent via scp linux command)
The problem is that even when I build the ELF binary with all needed libs, when I try to execute it on the remote machine, I got this error:
/tmp/25636: error while loading shared libraries: libnftnl.so.11: cannot open shared object file: No such file or directory
Since I can't execute sudo apt install -y libfuse-dev libmnl-dev libnftnl-dev
to install my libs on the remote machine , I wanted to know if it was possible to package all the dependancies within the ELF binary, so that the ELF binary can be executed in a standalone way.
bguess.
Solution
@जलजनक was right. adding the -static
flag works, but the thing is that you have to add it at the right place !
For me it was right after the -o OUTPUT_FILE
and before CFLAGS
and LDFLAGS
I also have to add -ldl at the end of everything
now I get this msgget failure: No space left on device
but its not linked to this question so thank you all for your help.
Answered By - bguess Answer Checked By - Robin (WPSolving Admin)