I am trying to patchelf a binary with many dependencies. I tried to add them one by one and at some point the binary started ignoring all the additional rpaths I was adding. For instance (I started adding the libraries to the nix profile to try to work around the issue):
$ patchelf --print-interpreter myapp
/nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib/ld-linux-x86-64.so.2
$ patchelf --print-rpath myapp
/nix/store/adxc893j47gxx3xjw403zdf0liiddvw2-glibc-2.32-48/lib:/nix/store/d9mfvhvksvsx0ar8pmxwhgwd9my045rp-gcc-10.3.0-lib/lib:/nix/store/9yzan8v1bks4284xzk7858n9392rpd18-glib-2.68.2/lib:/nix/store/0b0mijbd7mp8gcglmkkdr2775ki38x9v-zlib-1.2.11/lib:/nix/store/p09aa1i9q82jbyzdhidwcafz7l4sihs9-util-linux-2.36.2/lib:/nix/store/zr8dj1sm6jhr3qil6nskp2qnmk0xf08g-sqlite-3.35.5/lib:/nix/var/nix/profiles/default/lib
$ ./myapp
./myapp: error while loading shared libraries: libkrb5.so.3: cannot open shared object file: No such file or directory
$ ls /nix/var/nix/profiles/default/lib/libkrb5.so.3
/nix/var/nix/profiles/default/lib/libkrb5.so.3
But adding the path to LD_LIBRARY_PATH
works:
$ env LD_LIBRARY_PATH=/nix/var/nix/profiles/default/lib ./myapp
Are there any constraints on how many paths can be added to the rpath?