nix-ld
nix-ld copied to clipboard
Can nix-ld be used in docker image created with nix2container?
Hi, I'm trying to create minimal docker image, that can run binaries. I've created repo @ https://github.com/nxy7/tiny and published this image to docker hub (in case anyone wants to test it) as nxyt/tiny:latest. Anyway - it doesn't work and any binary I run results in bash: ./main: cannot execute: required file not found
.
As far as I understand binaries expect linker at specific location, so even if ldd my-binary
shows that all dependencies are present it still tries to call linker at /lib64/xxx
and because there's none, that's why my binaries are failing.
If I got that right, that's the problem that nix-ld is trying to solve, but I cannot really get that to work with nix2container.
What I've tried was adding nix_ld to copyToRoot
and adding 'lib' and 'lib64' to 'pathsToLink' and I've also added NIX_LD env variable, but that still doesn't work.
Can nix-ld be used to fix that error, or is it made only for NixOS? Any guidance toward getting that to work would be great :-)