[Nix-dev] Compile Haskell program on nixos that works on ubuntu server

Cody Goodman codygman.consulting at gmail.com
Sat Jul 5 10:35:07 CEST 2014


When compiled on nixos (even with -static) binaries come out like this:

[cody at cody-nixos:~/haskell/programs/myprogram]$ ldd
dist/build/myprogram/myprogram
    linux-vdso.so.1 (0x00007fffe355d000)
    libz.so.1 =>
/nix/store/kksws74v0v0jf6dl6f5fhw24dygzairc-zlib-1.2.8/lib/libz.so.1
(0x00007f122735d000)
    librt.so.1 =>
/nix/store/pdskwizjw8ar31hql2wjnnx6g0s6xc50-glibc-2.19/lib/librt.so.1
(0x00007f1227155000)
    libutil.so.1 =>
/nix/store/pdskwizjw8ar31hql2wjnnx6g0s6xc50-glibc-2.19/lib/libutil.so.1
(0x00007f1226f52000)
    libdl.so.2 =>
/nix/store/pdskwizjw8ar31hql2wjnnx6g0s6xc50-glibc-2.19/lib/libdl.so.2
(0x00007f1226d4e000)
    libgmp.so.10 =>
/nix/store/wxkad81khi8gzxs8kppq5yqkki5hy0np-gmp-5.1.3/lib/libgmp.so.10
(0x00007f1226acb000)
    libm.so.6 =>
/nix/store/pdskwizjw8ar31hql2wjnnx6g0s6xc50-glibc-2.19/lib/libm.so.6
(0x00007f12267ca000)
    libgcc_s.so.1 =>
/nix/store/9fb027n5a2lf9qwpb98v77iycqq552pf-gcc-4.8.2/lib64/libgcc_s.so.1
(0x00007f12265b4000)
    libc.so.6 =>
/nix/store/pdskwizjw8ar31hql2wjnnx6g0s6xc50-glibc-2.19/lib/libc.so.6
(0x00007f1226207000)
    libpthread.so.0 =>
/nix/store/pdskwizjw8ar31hql2wjnnx6g0s6xc50-glibc-2.19/lib/libpthread.so.0
(0x00007f1225fe9000)
    /nix/store/pdskwizjw8ar31hql2wjnnx6g0s6xc50-glibc-2.19/lib/ld-linux-x86-64.so.2
(0x00007f1227575000)

I'm guessing I could use patchelf to change all of these manually? Is
there an easier way to statically link my binaries or am I doomed to
having to patchelf each field from now on myself?


More information about the nix-dev mailing list