Skip to content

gcc: create dummy crtstuff on loongarch64#258032

Merged
1 commit merged intoNixOS:masterfrom
wegank:loongarch64-cross-fix
Oct 22, 2023
Merged

gcc: create dummy crtstuff on loongarch64#258032
1 commit merged intoNixOS:masterfrom
wegank:loongarch64-cross-fix

Conversation

@wegank
Copy link
Member

@wegank wegank commented Sep 29, 2023

Description of changes

A hacky workaround to fix #252590.

The workaround can be trivially modified to work for #243614, but the underlying reason is unjustified. I've therefore decided not to generalize this PR.

Things done

  • Built on platform(s)
    • loongarch-linux (cross)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@wegank wegank requested a review from a user September 29, 2023 12:55
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Sep 29, 2023
@wegank
Copy link
Member Author

wegank commented Sep 29, 2023

@ofborg build pkgsCross.loongarch64-linux.freshBootstrapTools.bootstrapFiles

@wegank wegank mentioned this pull request Sep 29, 2023
12 tasks
@wegank
Copy link
Member Author

wegank commented Oct 12, 2023

@trofi, would you like to have a look?

@trofi
Copy link
Contributor

trofi commented Oct 13, 2023

@trofi, would you like to have a look?

I'm afraid I can't comment on the fix's usefullness. If it works for you then yay!

nixpkgs degraded quite a bit in ability to cross-commpile even simple linux-targeting toolchains after #238154 and #241206 and regressions after an obvious (to me) breakage are still not fixed.

After those it's very hard to reason about pre-libc gcc in nixpkgs. It differs from what upstream expects and what other distributions expect from the bootstrap.

Maybe reviewers of the changes above or gcc maintainers can help you to review it.

If it helps I can re-iterate what an usual expectation is for gcc cross-build:

  1. cross-binutils is built (no c++ or c sipport on target)
  2. cross-gcc is built (no libc or shared library support on target, libgcc.aprovides onlygcc` primitives and does not implement external unwinder)
  3. target glibc is built (no c++ support on target)
  4. cross-gcc is built with full support for shared libraries (we have glibc crt to do it)
  5. target glibc is built (c++ and unwinder support for target)

I can reason about [4.] state of gcc built. But nixpkgs (AFAIU) does something very different and confuses gcc around detection of various target features like global constructor support.

It would be nice to compare config.log you get from your fix and the hypothetical [2.] and [.4] builds. Maybe they are close enough.

@ghost ghost merged commit 0a8e3e0 into NixOS:master Oct 22, 2023
@wegank wegank deleted the loongarch64-cross-fix branch October 22, 2023 14:17
@ghost ghost mentioned this pull request Oct 23, 2023
13 tasks
ghost pushed a commit that referenced this pull request Oct 25, 2023
This commit replicates the fix in
#258032 for S390 as well.

Co-authored-by: Artturi <Artturin@artturin.com>
ConnorBaker pushed a commit to nixos-cuda/cuda-legacy that referenced this pull request Apr 14, 2025
This commit replicates the fix in
NixOS/nixpkgs#258032 for S390 as well.

Co-authored-by: Artturi <Artturin@artturin.com>
@wegank wegank added the 6.topic: loongarch64 LoongArch, a new RISC ISA used on Loongson CPUs label Apr 29, 2025
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: loongarch64 LoongArch, a new RISC ISA used on Loongson CPUs 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pkgsCross.loongarch64-linux.stdenv broken by #238154

2 participants