Embedded Linux Tricks
How to run an executable compiled with a libc version different than the default one
The first option is to run the executable with the following wrapper:
where $PREFIX
is the directory where the non-standard libc is and $BINARY
is the binary that needs to be executed. This approach doesn’t maintain the argv[0]
for the program being executed (so it can be a problem for programs that use it to decide what to do such as git).
The second option is to use the patchelf
tool to set a different interpreter (ld-linux.so
) and RPATH
( $PREFIX/lib/:$PREFIX/usr/lib/
) in the binary.
Make sure you don’t patch `ld.so`!
The script below takes some debian binary packages from ./debs
and automatically patches them: