Skip to content

gcc: set GFORTRAN_FOR_TARGET on cross-built native compilers#231020

Merged
Artturin merged 1 commit intomasterfrom
unknown repository
Sep 21, 2023
Merged

gcc: set GFORTRAN_FOR_TARGET on cross-built native compilers#231020
Artturin merged 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented May 10, 2023

Closes #230626

Description of changes

For a cross-built native compiler, i.e. build!=(host==target), the bundled libgfortran needs a gfortran which can run on the buildPlatform and emit code for the targetPlatform. The compiler which is built alongside gfortran in this configuration doesn't meet that need: it runs on the hostPlatform.

This commit passes the necessary compiler via GFORTRAN_FOR_TARGET, using pkgsBuildTarget.gfortran.

Things done
  • Built on platform(s)
    • 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.05 Release Notes (or backporting 22.11 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.

@ofborg ofborg bot added 6.topic: cross-compilation Building packages on a different platform than they will be used on 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 May 10, 2023
@ghost ghost marked this pull request as ready for review May 10, 2023 12:35
@ghost ghost requested a review from matthewbauer as a code owner May 10, 2023 12:35
@ghost
Copy link
Copy Markdown
Author

ghost commented May 10, 2023

@ofborg eval

@ghost
Copy link
Copy Markdown
Author

ghost commented Jul 12, 2023

Rebased.

For a cross-built native compiler, i.e. build!=(host==target), the
bundled libgfortran needs a gfortran which can run on the
buildPlatform and emit code for the targetPlatform.  The compiler
which is built alongside gfortran in this configuration doesn't meet
that need: it runs on the hostPlatform.

This commit passes the necessary compiler via `GFORTRAN_FOR_TARGET`,
using `pkgsBuildTarget.gfortran`.
@Artturin
Copy link
Copy Markdown
Member

Rebased

Copy link
Copy Markdown
Member

@Artturin Artturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes pkgsCross.aarch64-multiplatform.gfortran. Thanks!

@Artturin Artturin merged commit 8a3676e into NixOS:master Sep 21, 2023
@ghost ghost deleted the pr/fix/230626 branch October 22, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 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.

Cross compilation of gfortran failed for riscv64

1 participant