!RbXGJhHMsnQcNIDFWN:nixos.org

Haskell in Nixpkgs/NixOS

742 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.org148 Servers

Load older messages


SenderMessageTime
19 Mar 2026
@alex:tunstall.xyzAlex I'm seeing a lot of "unknown operand" errors coming from clang during a stage 1 build.
I'll try llvm-as instead.
20:17:24
@sternenseemann:systemli.orgsterni (he/him)LLVMAS should be clang as was my understanding20:25:47
@sternenseemann:systemli.orgsterni (he/him)configure.ac literally checks for clang20:26:08
@sternenseemann:systemli.orgsterni (he/him)GHC cross may work again it was horribly broken last I checked20:26:38
@sternenseemann:systemli.orgsterni (he/him)there are aspects of it that are still broken and I couldn't get my first patch for that merged iirc 20:27:56
@sternenseemann:systemli.orgsterni (he/him) Alex: https://gitlab.haskell.org/ghc/ghc/-/blob/f8817879f94e4ea3e603808fd6370b8365818911/configure.ac#L556 20:28:00
@alex:tunstall.xyzAlex

Well, I just got to stage2 in the build with llvm-as and, sure enough, it doesn't work:

llvm-as: Unknown command line argument '-iquotelibraries/ghc-prim/GHC'.  Try: '/nix/store/8cn6305g0gsrczz3ga298k0zilfzgs7r-llvm-20.1.8/bin/llvm-as --help'
llvm-as: Did you mean '--help-list-hidden'?
[...]
20:28:45
@sternenseemann:systemli.orgsterni (he/him)ah it was lol https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1393220:29:01
@alex:tunstall.xyzAlex

Anyway, back on clang, I'm getting many errors in the assembly that GHC generates, e.g.

/build/ghc44067_0/ghc_7.s:11:7: error:
     error: unknown operand
            subq    $40, %rsp
                    ^
   |
11 |         subq    $40, %rsp
   |       ^

I can upload a full log, but I doubt it's very insightful.

It seems that instead of targeting LLVM assembly, it's generating something else?

20:33:06
@teoc:matrix.orgTeo (he/him)https://gitlab.haskell.org/ghc/ghc/-/merge_requests/15231 should make a big difference. Sven is currently splitting off bits from this large branch and getting them merged20:33:07
@sternenseemann:systemli.orgsterni (he/him) Alex: do clang/LLVMAS version and LLVM version match? 20:38:42
@alex:tunstall.xyzAlex

I would assume so, because I've undone the changes I made to LLVMAS.
I think this is just happening because:

  1. I set the target stage to 3 (instead of 1).
  2. I removed the --host configure flag because the script still complains about "build != host"

I'm not very familiar with x86 assembly, but it does look like x86 assembly. Even though GHC is being explicitly given -fllvm.

20:41:12
@alex:tunstall.xyzAlex *

I would assume so, because I've undone the changes I made to LLVMAS.
I think this is just happening because:

  1. I set the target stage to 3 (instead of 1 or 2).
  2. I removed the --host configure flag because the script still complains about "build != host"

I'm not very familiar with x86 assembly, but it does look like x86 assembly. Even though GHC is being explicitly given -fllvm.

20:41:32
@alex:tunstall.xyzAlex

Is the TH external interpreter supposed to work?

iserv-proxy-interpreter: tmp/nix/store/7kjpbn6fv6gqi9fx65ann5bqdsm3s9fi-riscv64-unknown-linux-gnu-ghc-9.10.3/lib/riscv64-unknown-linux-gnu-ghc-9.10.3/lib/riscv64-linux-ghc-9.10.3/ghc-prim-0.12.0-561f/libHSghc-prim-0.12.0-561f.a: RTS linker not implemented on riscv
iserv-proxy-interpreter: loadArchive "tmp/nix/store/7kjpbn6fv6gqi9fx65ann5bqdsm3s9fi-riscv64-unknown-linux-gnu-ghc-9.10.3/lib/riscv64-unknown-linux-gnu-ghc-9.10.3/lib/riscv64-linux-ghc-9.10.3/ghc-prim-0.12.0-561f/libHSghc-prim-0.12.0-561f.a": failed

(Context: fixing the pkgsCross.riscv64.buildPackages.ghc build and trying to cross-compile some Haskell packages)

21:45:17
@sternenseemann:systemli.orgsterni (he/him) cc alexfmpe 21:51:23
@sternenseemann:systemli.orgsterni (he/him) I guess you may need to amend the default for enableExternalInterpreter 21:51:49
@alex:tunstall.xyzAlex Could maybe do something similar to common-have-ncg.nix, like common-have-rts-linker.nix.
Anyway, this feels like something that should be advertised by ghc.passthru and not blindly assumed (e.g. what if it's built without TH support?).
21:58:58
@alex:tunstall.xyzAlex Anyway, here's the PR fixing pkgsCross.riscv64.buildPackages.ghc (but not touching the TH issue).
https://github.com/NixOS/nixpkgs/pull/501439
22:00:07
@alex:tunstall.xyzAlex * Here's the PR fixing pkgsCross.riscv64.buildPackages.ghc (but not touching the TH issue).
https://github.com/NixOS/nixpkgs/pull/501439
22:00:41
@alexfmpe:matrix.orgalexfmpehttps://gitlab.haskell.org/ghc/ghc/-/commit/a0e417411fa6518436741aabe2c72e22a3309b19#b7ec52d5e302083ed03503182f1293694dda24f3_438_43823:56:04
@alexfmpe:matrix.orgalexfmpeSeems to only have been supported for risc recently23:56:15
@alexfmpe:matrix.orgalexfmpeMaybe try 9.1223:56:33
@alexfmpe:matrix.orgalexfmpeI never was able to test riscv because of the libffi error23:56:47
20 Mar 2026
@alexfmpe:matrix.orgalexfmpe
In reply to @sternenseemann:systemli.org
I guess you may need to amend the default for enableExternalInterpreter
Not sure there's a benefit. It would fail with the 'need external interpreter' message instead?
00:19:48
@alexfmpe:matrix.orgalexfmpeAs long as iserv-proxy builds for that platform, I don't think there's regressions by enabling external interpreter00:20:21
@alex:tunstall.xyzAlex

Of course, then it is necessary to manually add the required paths to the package db after installation.

sterni would you happen to know how to do that, given that you mentioned it?
If not, I will spend some time figuring it out.
I tried your suggestion, and it is indeed in need of something extra for libffi to make the compiler fully functional.

ld.gold: error: cannot find -lffi

It looks like libffi is already in depsTargetTargetPropagated, so I don't understand why it's not made available in package builds.

00:23:17
@alex:tunstall.xyzAlexThat's true, but it does needlessly increase the build closure.00:24:18
@alexfmpe:matrix.orgalexfmpeFair. There's an opt out for ghcjs, maybe add it for riscv, possibly conditional on version. Does 9.12 or 9.14 work?00:25:27
@alexfmpe:matrix.orgalexfmpeAlso, treatment of libffi changed recently on ghc. Maybe try ghcHEAD 00:26:34
@alex:tunstall.xyzAlex I noticed that GHC considers it important enough to mention whether the RTS linker exists in --info, so I'm leaning more and more in favour of adding it to passthru. 00:33:50

Show newer messages


Back to Room ListRoom Version: 6