Indeed. Foreign binaries must be patched to modify the interpreter (i.e. the dynamic library loader, also known as ld-linux) and the RPATH (the library path). $ patchelf --print-interpreter /bin/sh /gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/ld-linux-x86-64.so.2 $ patchelf --set-interpreter /gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/ld-linux-x86-64.so.2 /path/to/foo/bin You can then check the libraries with ldd: $ ldd /path/to/foo/bin linux-vdso.so.1 (0x00007ffefb6e4000) libreadline.so.7 => /gnu/store/s5qvyb3lp0b12qmgiwj3754an7dr1r0s-readline-7.0.3/lib/libreadline.so.7 (0x00007f0b638f7000) libhistory.so.7 => /gnu/store/s5qvyb3lp0b12qmgiwj3754an7dr1r0s-readline-7.0.3/lib/libhistory.so.7 (0x00007f0b636ed000) libncursesw.so.6 => /gnu/store/s9gbq6q72w9vf7zjm0amjf1iw1fy856h-ncurses-6.1/lib/libncursesw.so.6 (0x00007f0b6347e000) libdl.so.2 => /gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/libdl.so.2 (0x00007f0b6327a000) libgcc_s.so.1 => /gnu/store/vla5j7pbkpcp39lsdfsmz7m9azn48lr4-gcc-5.5.0-lib/lib/libgcc_s.so.1 (0x00007f0b63063000) libc.so.6 => /gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib/libc.so.6 (0x00007f0b62cb0000) libbgdrtm.so => not found In this example, one library is missing. If you check the RPATH, you can see the list of folders that are search for libraries: $ patchelf --print-rpath /path/to/foo/bin /gnu/store/s5qvyb3lp0b12qmgiwj3754an7dr1r0s-readline-7.0.3/lib:/gnu/store/s9gbq6q72w9vf7zjm0amjf1iw1fy856h-ncurses-6.1/lib:/gnu/store/l4lr0f5cjd0nbsaaf8b5dmcw1a1yypr3-glibc-2.27/lib:/gnu/store/vla5j7pbkpcp39lsdfsmz7m9azn48lr4-gcc-5.5.0-lib/lib:/gnu/store/vla5j7pbkpcp39lsdfsmz7m9azn48lr4-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../.. You can extend the RPATH to include the missing library: $ patchelf --set-rpath /path/to/missing/lib /path/to/foo/bin And it should work! Hope that helps! -- Pierre Neidhardt