!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

724 Members
For discussions and questions about Haskell with Nix, cabal2nix and haskellPackages in nixpkgs | Current Docs: https://haskell4nix.readthedocs.io/ | More Nix: #community:nixos.org | More Haskell: #haskell-space:matrix.org145 Servers

Load older messages


SenderMessageTime
26 Apr 2025
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC) Because the attribute is referenced from buildPackages: https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/haskell-packages.nix#L482 13:04:18
@sternenseemann:systemli.orgsterni (he/him) haskell.packages.*.ghc is like stdenv.cc 13:04:56
@sternenseemann:systemli.orgsterni (he/him) haskell.compiler.* would be cross compiled 13:05:10
@emilazy:matrix.orgemily hm, wouldn't it make more sense to use buildPackages explicitly for that? 13:08:49
@emilazy:matrix.orgemily I assume that pkgsCross.foo.* is going to have host foo unless * starts with buildPackages. (with stdenv as an unfortunate exception) 13:09:20
@emilazy:matrix.orgemilyI guess there are probably other unfortunate exceptions already though.13:09:31
@emilazy:matrix.orgemilyWTB universe without the GNU idea of cross…13:10:01
@sternenseemann:systemli.orgsterni (he/him)as said, it’s like stdenv with all the weirdness involved, this is probably the best way to do it. You can’t even do an equivalent of libc/cc split13:26:18
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC) I think I'm on the right track now. The performance impact of enableUnregisterised is really huge 14:36:42
@ashinnv:matrix.orgMr Mayhem changed their display name from Magnolia Mayhem to Magnolia Mayhem: Rallycar Mailman.14:40:29
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC) @sterni I now get to the same point you got in https://gitlab.haskell.org/ghc/ghc/-/issues/22006 now 15:37:01
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)The log says "Run Ghc CompileHs Stage1" but the resulting ghc is stage015:38:16
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC) But if, say, I put this ghc into the derivation again, it would start complaining about hostPlatform != buildPlatform 15:39:17
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)Like they said in https://gitlab.haskell.org/ghc/ghc/-/issues/22006#note_448234 and https://gitlab.haskell.org/ghc/ghc/-/wikis/building/cross-compiling#terminology-and-background15:40:55
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)"build must equal host"15:41:06
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC) But someone wrote here https://bbs.loongarch.org/d/150-ghc-loongarch that they did cross compile to loongarch64 2 years ago with ghc 9.6 and they just used --target=loongarch64-unknown-linux-gnu and hadrian/build, nothing special 15:43:43
@alex:tunstall.xyzAlex

Make used nonstandard cross terminology and the configure script was designed to match.

Hadrian fixed that confused terminology, but the configure script was never updated to match.

16:00:37
27 Apr 2025
@sternenseemann:systemli.orgsterni (he/him)What makes you say that? stage0 is passed in (i.e. the bootstrap compiler), so you can't really get it out.09:38:10
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @sternenseemann:systemli.org
What makes you say that? stage0 is passed in (i.e. the bootstrap compiler), so you can't really get it out.
The resulting binary is x86_64-x86_64-loong64,instead of x86_64-loong64-loong64
09:39:26
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)build-host-target09:39:36
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @aleksana:mozilla.org
The log says "Run Ghc CompileHs Stage1" but the resulting ghc is stage0
But this took me 40 minutes
09:39:59
@sternenseemann:systemli.orgsterni (he/him)That's stage1 then.09:41:27
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @sternenseemann:systemli.org
That's stage1 then.
So as its document suggests the resulting binary should run on loongarch64
09:42:31
@sternenseemann:systemli.orgsterni (he/him)

GHC, in terms of cross really only has two variables when it comes down to it:

  • stage0 you pass in and it has to be a native compiler.
  • target: which sets the target for all GHCs produced by the build system.

This gives you, assuming you set target to be different from host:

  1. Stage0 builds Stage1. Stage1 is (host==build)->target, a cross compiler.
  2. Stage1 builds Stage2. Stage2 is target->target, a cross compiled native GHC.
09:46:30
@sternenseemann:systemli.orgsterni (he/him)

Or as the document says:

So considering the two cases we identified at the top of the page:

  • Building GHC as a cross-compiler - this is the stage 1 compiler
  • Cross-compiling GHC itself - this is the stage 2 compiler

both of these cases are handled in the same way.

09:47:13
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @sternenseemann:systemli.org

GHC, in terms of cross really only has two variables when it comes down to it:

  • stage0 you pass in and it has to be a native compiler.
  • target: which sets the target for all GHCs produced by the build system.

This gives you, assuming you set target to be different from host:

  1. Stage0 builds Stage1. Stage1 is (host==build)->target, a cross compiler.
  2. Stage1 builds Stage2. Stage2 is target->target, a cross compiled native GHC.
So we don't have derivation for stage2 yet?
09:50:49
@sternenseemann:systemli.orgsterni (he/him)Building a cross compiler (stage1) is largely unproblematic and works well with hadrian. Building Stage2 is much more problematic, precisely because it's treated as “just running stage1 again” which doesn't give many avenues for prescribing different tools, libs etc. I'm relatively sure that, for us, it just works because cc-wrapper checks the architecture of libraries before linking since GHC has no ability to differentiate the inputs.09:50:55
@sternenseemann:systemli.orgsterni (he/him)We have, what where you trying to build?09:51:07
@sternenseemann:systemli.orgsterni (he/him)* We have, what were you trying to build?09:51:12
@aleksana:mozilla.orgaleksana 🏳️‍⚧️ (force me to bed after 18:00 UTC)
In reply to @sternenseemann:systemli.org
We have, what where you trying to build?
a ghc bindist tarball that runs on loongarch64 of course
09:51:41

Show newer messages


Back to Room ListRoom Version: 6