cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.39k stars 330 forks source link

Cross distro support #168

Open hugosenari opened 1 year ago

hugosenari commented 1 year ago

Describe the problem Some compiling tools set interpreter to nix store

Some users may compile with nix tooling and run on Linux LSB FHS

:sob: fail to run :grinning: Happy

To Reproduce

cc  hello.c -o hello
ldd hello
# /nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib/ld-linux-x86-64.so.2 => /nix/store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163/lib64/ld-linux-x86-64.so.2 (0x00007f2a584be000)

Copy to machine without Nix store

./hello
exec: Failed to execute process './hello.a': The file exists and is executable. Check the interpreter or linker?

Then apply patchelf

cp hello hellow
patchelf  --set-interpreter  /lib64/ld-linux-x86-64.so.2 hellow

Copy to a machine without Nix store

./hellow
Hello, World!

Related: #145

domenkozar commented 1 year ago

Would this entail static compilation?

hugosenari commented 1 year ago

I'm a newbie on this topic. I don't know what would be the best solution. Options