Is it possible to achieve static linking with musl + openmp

I have been trying to get statically linked versions of a few bioinformatics tools using Nix and musl.

One tool that is giving me trouble is megahit, which seems to be due to its use of openmp. It compiles and links fine and you can run it:

nix-shell '<nixpkgs>' -p pkgsCross.musl64.pkgsStatic.megahit

(This works if your version of nixpkgs is recent enough to include PR171469)

However, it promptly crashes once it hits certain regions of the code that use openmp. A little googling seems to indicate that this is not recommended and I should not even try it, but there is not a lot of information and many of it is from >5 years ago.

Possible? Probably.

If you want to fix the package, take a look at how other musl-based distros package it. Alpine, Void or perhaps even Gentoo would be good starting points.

I’d highly recommend opening an issue in Nixpkgs to get input from other users or the author of the PR you mentioned.

Does openmp use userspace GPU drivers to any capacity? If so, you might be running into ABI incompatibilities because those will likely be built against glibc.

FYI, pkgsStatic is musl anyways because it was too troublesome to do it with glibc IIRC.

1 Like