5 ms·
Fair question:) GHC binaries dynamically link certain C libraries, which must be present (and in the right version range) at runtime. This can cause trouble. I
by seagreen 11y ago
Fair question:) GHC binaries dynamically link certain C libraries, which must be present (and in the right version range) at runtime. This can cause trouble.
I'd be curious to hear if there's a convenient way to build an entirely statically linked GHC binary. I've searched around some but haven't found an easy answer yet.
- dhess 11y agoYou'll find this Reddit thread useful: https://www.reddit.com/r/haskell/comments/3kjpwe/how_to_easily_create_portable_binaries_for_linux/ https://www.reddit.com/r/haskell/comments/3kjpwe/how_to_easi...
- seagreen 11y agoSweet, thanks!
- arianvanp 11y agohttps://github.com/nilcons/ghc-musl https://github.com/nilcons/ghc-musl Uses musl to create fully statically linked binaries
- seagreen 11y agoSlick, thanks!
- prodigal_erik 11y agoNot sure about .deb format, but rpmbuild will automatically add dependencies on packaged shared libraries using their sonames: http://www.rpm.org/max-rpm/s1-rpm-depend-auto-depend.html http://www.rpm.org/max-rpm/s1-rpm-depend-auto-depend.html If you smuggle unpackaged code onto a QA or build machine, IMHO you asked for whatever happens to you.
- thinkpad20 11y agoYou can use nix to do your package management. It has many features and advantages (build speed, deterministic build environments, language agnosticism, etc), but specific to what you brought up it makes it trivial to declare a runtime dependency of package A on package B, and guarantee that as long as package A is installed, that package B will be as well, and be accessible to A. I believe it's pretty popular in the Haskell community; I do all of my Haskell development with it and use it with Python at work, where it's slowly starting to gain traction at my company.
- seagreen 11y agoHello from NixOS:) (https://github.com/seagreen/vivaine https://github.com/seagreen/vivaine) I don't think nixpkgs is a direct solution to this problem though. (A) Sometimes you're stuck with cabal-install because the rest of the people in the project use it. Nixpkgs includes many different sets of haskell packages, but isn't designed to pull in arbitrary versions of lots of different haskell packages by default. (B) Even if the rest of the team was using a set of haskell packages compatible with one of the Nixpkgs sets, it still involves extra work to figure out what C libraries the computer you're deploying to has, and then to make sure they're packaged for Nixpkgs and build with them. I think Nixpkgs and NixOS are _fantastic_ tools, but they aren't a panacea for all haskell deployment solutions.
- thinkpad20 11y agoWell I certainly wouldn't call anything a panacea, but I'm not sure I'd fully agree with either of those criticisms. Having other people in the project use cabal install -- well, you can't blame a tool for other people not using it. It's true that nixpkgs doesn't track multiple versions of packages, but using the existing tooling (cabal2nix) it should be possible to fix down the versions you need. Towards the second point, nix isn't meant to figure out what C libraries you need; it's meant to let you specify exactly what those are and be confident that those will be respected.