Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openmp: fix cross compile #197674

Merged
merged 1 commit into from
Nov 22, 2022
Merged

openmp: fix cross compile #197674

merged 1 commit into from
Nov 22, 2022

Conversation

squalus
Copy link
Member

@squalus squalus commented Oct 25, 2022

Description of changes

Fixes cross compile for openmp.

Doesn't cause any rebuilds.

Tested cross builds from x86_64-linux -> aarch64-linux on llvmPackages 10 through 14. Tested all evaluations. Tested compilation of a few dependent packages.

The following attrs are now expected to build:

pkgsCross.aarch64-multiplatform.llvmPackages_5.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_6.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_7.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_8.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_9.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_10.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_11.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_12.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_13.openmp
pkgsCross.aarch64-multiplatform.llvmPackages_14.openmp

The following attrs are expected to produce the same output as the normal native build:

pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_5.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_6.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_7.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_8.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_9.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_10.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_11.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_12.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_13.openmp
pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_14.openmp
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/)
  • 22.11 Release Notes (or backporting 22.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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@squalus squalus added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Oct 25, 2022
@@ -15,7 +16,9 @@ stdenv.mkDerivation rec {
src = fetch pname "0i4bn84lkpm5w3qkpvwm5z6jdj8fynp7d3bcasa1xyq4is6757yi";

nativeBuildInputs = [ cmake perl ];
buildInputs = [ llvm ];
buildInputs = [
(if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
Copy link
Contributor

Choose a reason for hiding this comment

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

(Commenting only on this one particular instance, but obviously applies to all.)

When buildPlatform == hostPlatform is there a meaningful difference between llvm and targetLlvm? In other words, could we always use targetLlvm here?

If this is done only to avoid rebuilds, I'd personally prefer rebuilds to long term code complexity / "technical debt".

Copy link
Member Author

@squalus squalus Oct 31, 2022

Choose a reason for hiding this comment

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

Here's why: if I simply use targetLlvm, then pkgsCross.aarch64-multiplatform.buildPackages.llvmPackages_14.openmp will result in a failed build. The "build" version of the llvm libraries is included instead of the expected "host" version. I admit I'm not sure why this is the case. There may be a better way to model this.

@rrbutani rrbutani mentioned this pull request Nov 7, 2022
92 tasks
Copy link
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.

eh good enough i think. something should be done about the code duplication going on with llvmPackages

@Artturin
Copy link
Member

@ofborg build pkgsCross.aarch64-multiplatform.llvmPackages_14.openmp

@Artturin Artturin merged commit 006c56a into NixOS:master Nov 22, 2022
ElvishJerricco pushed a commit to ElvishJerricco/nixpkgs that referenced this pull request Jan 8, 2023
github-actions bot pushed a commit that referenced this pull request Jan 28, 2023
K900 pushed a commit that referenced this pull request Jan 28, 2023
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 3, 2023
this was backported to `llvmPackages_15` in
81ef82a
rrbutani added a commit to rrbutani/nixpkgs that referenced this pull request Apr 5, 2023
this was backported to `llvmPackages_15` in
81ef82a
RaitoBezarius pushed a commit that referenced this pull request Apr 14, 2023
this was backported to `llvmPackages_15` in
81ef82a
RaitoBezarius pushed a commit to rrbutani/nixpkgs that referenced this pull request Apr 16, 2023
this was backported to `llvmPackages_15` in
81ef82a
RaitoBezarius added a commit that referenced this pull request Apr 19, 2023
llvmPackages_git.openmp: apply #197674 (fix cross compile)
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 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants