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

clang: fix crosscompilation for 16.x #238597

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

avnik
Copy link
Contributor

@avnik avnik commented Jun 19, 2023

Description of changes

Fix cross-compilation issue for clang 16.x (port existing fix from 15.x branch)

Closing #238432

Things done
  • Built on platform(s)
    • x86_64-linux
    • x86_64-linux.pkgsCross.aarch64-multiplatform
    • 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.

@RaitoBezarius
Copy link
Member

@ofborg build pkgsCross.aarch64-multiplatform.clang16

@avnik
Copy link
Contributor Author

avnik commented Jun 19, 2023

@ofborg build pkgsCross.aarch64-multiplatform.clang_16

@avnik
Copy link
Contributor Author

avnik commented Jun 19, 2023

fix ofborg mention, to match proper attribute

@RaitoBezarius
Copy link
Member

Thank you!

@rrbutani
Copy link
Contributor

Ah, thanks; looks like we forgot to apply #226551 to llvmPackages_16.

Would you mind copying the stdenv.buildPlatform.canExecute change from that PR as well? (It looks like we're not running into the maybe-uninitialized warning with LLVM 16 so we can leave that bit out)

@avnik
Copy link
Contributor Author

avnik commented Jun 19, 2023

@rrbutani you about this snippet?

    env = lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
      # The following warning is triggered with (at least) gcc >=
      # 12, but appears to occur only for cross compiles.
      NIX_CFLAGS_COMPILE = "-Wno-maybe-uninitialized";
    };

In my setup it not failed, but I can add this fragment, if you feel it important.

@avnik
Copy link
Contributor Author

avnik commented Jun 19, 2023

Can confirm, that all rebuild successfully exactly on this commit:

 nix build ".#pkgsCross.aarch64-multiplatform.clang_16" -L --cores 24

@vcunat vcunat added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jun 20, 2023
@rrbutani
Copy link
Contributor

@avnik I meant this bit (to be changed here):

-] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [

It's not a big deal (cross comp will work without it; this just lets us skip an extra LLVM build in cases where the build platform can execute host platform binaries — i.e. x86_64 and i386), I mostly just wanted to keep the LLVM package sets in sync.

@avnik avnik force-pushed the avnik/clang-fix-crosscompilation branch from dc5fde1 to cef1efe Compare June 23, 2023 10:39
@avnik
Copy link
Contributor Author

avnik commented Jun 23, 2023

@rrbutani all done

@ofborg ofborg bot requested a review from rrbutani June 23, 2023 10:58
@Artturin Artturin merged commit d9a2741 into NixOS:master Jun 23, 2023
@avnik
Copy link
Contributor Author

avnik commented Jun 24, 2023

@rrbutani Should I also PR this for stable branch?

@github-actions
Copy link
Contributor

Successfully created backport PR for release-23.05:

@Artturin
Copy link
Member

members can add labels

@avnik avnik deleted the avnik/clang-fix-crosscompilation branch June 24, 2023 20:17
@sternenseemann
Copy link
Member

Seems like pkgsStatic.llvmPackages_15.clang-unwrapped is still broken with trouble executing clang-tblgen. Seems it also doesn't work for 15, will need some investigation. It definitely used to work for llvmPackages_11.

@Artturin
Copy link
Member

Seems like pkgsStatic.llvmPackages_15.clang-unwrapped is still broken with trouble executing clang-tblgen. Seems it also doesn't work for 15, will need some investigation. It definitely used to work for llvmPackages_11.

https://github.com/NixOS/nixpkgs/pull/226551/files#r1300386564

@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
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 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants