| 23 Jan 2024 |
Alex | * If you're compiling natively (YMMV for cross-compilation), the following should work, since it seems to be used by all gcc compilers, including when compiling gcc itself from the bootstrap gcc.
nixpkgs.localSystem.gcc.arch = "rv64g";
| 13:20:53 |
rdg | Alex: I'm cross compiling, so I tried adding it in the nixpkgs.crossSystem.gcc.arch but I don't see it with NIX_DEBUG=1 being added anywhere | 13:27:30 |
rdg | for native compilation we had successfully used nixpkgs.localSystem.gcc.arch in other tests | 13:28:13 |
rdg | https://github.com/NixOS/nixpkgs/blob/15ff1758e7816331033baa14eebbea68626128f3/pkgs/build-support/cc-wrapper/default.nix#L601 | 15:33:44 |
rdg | it is injected before not after the original flags | 15:34:03 |
Alex | In reply to @rdg:matrix.org https://github.com/NixOS/nixpkgs/blob/15ff1758e7816331033baa14eebbea68626128f3/pkgs/build-support/cc-wrapper/default.nix#L601 I think it's because isGccArchSupported "rv64g" is false and you have to patch nixpkgs so that it doesn't think the arch isn't supported.
That whole function is a nightmare for RISC-V's highly customisable ISA... | 15:55:39 |
rdg | the flag arrives to cc-cflags-before | 15:57:33 |
rdg | the problem is that some packages inject their own -march, overriding it | 15:57:55 |
rdg | that's why I used NIX_CFLAGS_COMPILE_riscv64_unknown_linux_gnu, as it gets added after | 15:58:20 |