On 09.10.2015 07:50, Bryan Gardiner wrote: > On Thu, 8 Oct 2015 00:03:23 +0200 > Kamil Chmielewski <[email protected]> wrote: > >> 2015-10-07 20:44 GMT+02:00 Bryan Gardiner <[email protected]>: >> >>>> your shell does not find "./go-app". >>>> What does ls -l say? >>> >> >> The file path is right and exists for sure. >> >> >>> Most likely Kamil is in the right directory, and this is just a known >>> quirk: bash tries to exec the program, the exec fails because the >>> binary's interpreter is set incorrectly, and bash incorrectly >>> interprets the failure as the program not existing. See >>> https://nixos.org/patchelf.html (although, there is an open bug about >>> patchelf not working on Go binaries, see >>> https://github.com/NixOS/patchelf/issues/66). >> >> Looks like the issue. Any ideas what to do? > > I'm not sure if you've tried patchelf and hit that bug, or if you > haven't... If you haven't, then try something like the following: > > $ patchelf --set-interpreter /lib/ld-linux.so.2 go-app > $ patchelf --set-rpath /lib:/usr/lib:/usr/local/lib go-app > $ ./go-app # (on Ubuntu) > > You should consult /etc/ld.so.conf on Ubuntu for the correct library > directories (not on Ubuntu here, so I can't see what how it does > things). > > I think though, wouldn't the correct thing to do (after setting the > interpreter) actually be to *remove* the RPATH from the binary to have > it work on non-NixOS, using the normal system library lookup? I don't > see a --remove-rpath option on patchelf though. I can't recall > whether RPATH inhibits normal lookup directories, if not then you > wouldn't need to change it, or you could just set it to be empty...
$ patchelf --set-rpath /lib:/usr/lib:/usr/local/lib go-app will 'replace' all previously set RPATHs so there is no need for --remove-rpath > See ld.so(8). > > Cheers, > Bryan > > > > _______________________________________________ > nix-dev mailing list > [email protected] > http://lists.science.uu.nl/mailman/listinfo/nix-dev > _______________________________________________ nix-dev mailing list [email protected] http://lists.science.uu.nl/mailman/listinfo/nix-dev
