nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

major: symbol not found when building static stack #79

Closed nh2 closed 4 years ago

nh2 commented 4 years ago

https://buildkite.com/nh2/static-haskell-nix/builds/273#a06ac192-1741-4de4-bac5-e470c724a6d0

With the latest nixpkgs master upgrade it shows:

[10 of 18] Compiling Pantry.Storage   ( src/Pantry/Storage.hs, dist/build/Pantry/Storage.o )

<no location info>: error:
    <command line>: can't load .so/.DLL for: /nix/store/929njkajlm1bqp6pn42zchgn4pba7qqw-unix-compat-0.5.1/lib/ghc-8.4.4/x86_64-linux-ghc-8.4.4/libHSunix-compat-0.5.1-IZ2l0C7CE13FdrCF8rJfBj-ghc8.4.4.so (Error relocating /nix/store/929njkajlm1bqp6pn42zchgn4pba7qqw-unix-compat-0.5.1/lib/ghc-8.4.4/x86_64-linux-ghc-8.4.4/libHSunix-compat-0.5.1-IZ2l0C7CE13FdrCF8rJfBj-ghc8.4.4.so: major: symbol not found)
nh2 commented 4 years ago

@qrilka said:

could it be about major not being a function but a macro in musl?

See:

nh2 commented 4 years ago

That's a very good guess. https://forums.gentoo.org/viewtopic-t-1090818-start-0.html supports that.

nh2 commented 4 years ago

We should find where in (apparently) unix-compat it's used.

nh2 commented 4 years ago

Found it:

Luckily github shows at the top the most recent commit named Fix sysmacros.h include for non-glibc libcs (#43) https://github.com/jacobstanley/unix-compat/commit/4394fb8d02cbe1eba8c9e83007296339a8e18b0d

nh2 commented 4 years ago

https://github.com/jacobstanley/unix-compat/pull/43

Fixed in unix-compat-0.5.2, and we have 0.5.1.

That explains it, thanks @qrilka !