Closed pachiras closed 3 years ago
The issue is that the link-loader embedded into your program (check readelf -a ./a.out| grep /nix
) and library paths will have nix store references: /nix/store
. I see two possible workarounds for this. In theory you could patchelf afterwards to fix those to point to /data/nas1/nix
for its rpath/ld or fix your NIX_CFLAGS_COMPILE
, NIX_LDFLAGS
to container /data/nas1/nix
instead of /nix
paths before compiling. However this will break if your libraries have dependencies as their rpath will have nix store references again. The other option would to statically link your program... You might want to look at pkgsStatic
for that.
There is nothing meaningful I can fix to help with that in nix-user-chroot
.
Third option: call your program with ldd
command and set LD_LIBRARY_PATH
according to what the rpath of your program contained before.
Thank you @Mic92. It became clear why I couldn't run the program. I'll look for solution in pkgsStatic. Thanks, again.
Hello,
Thank you for sharing the great program. But I have a difficulty in building a program with nix-shell.
I wanted to build a program with gcc8. So, here is what I tried:
Once I get out of the nix-user-chroot environment, I cannot execute the program anymore. What I want to do is just using nix as a developing environment. I would be happy if I could use the program outside of the environment. Is it possible?