I'm using patchelf to modify rpath and the interpreter for already compiled binaries. The calls to patchelf look something like this:
patchelf --set-interpreter "\$ORIGIN/lib/ld-linux-x86-64.so.2" --set-rpath "\$ORIGIN/lib" ./grep
These are being set correctly, as verified by running readelf -l ./grep | grep interpreter
, which outputs:
[Requesting program interpreter: $ORIGIN/lib/ld-linux-x86-64.so.2]
When I try to run the executable, however, I get the following error:
-bash: ./grep: No such file or directory
This seems to indicate that there's an issue with the linker. If I specify an absolute path instead of using $ORIGIN
then it seems to work fine.
I'm wondering if there's something incorrect about how I'm using $ORIGIN
here, or if this is perhaps something that has perhaps been disabled on a system level?