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

zig_0_10: fix macOS build #221153

Merged
merged 1 commit into from
Mar 15, 2023
Merged

zig_0_10: fix macOS build #221153

merged 1 commit into from
Mar 15, 2023

Conversation

kubkon
Copy link
Contributor

@kubkon kubkon commented Mar 14, 2023

Relevant upstream issue: ziglang/zig#14559

The patch is a backport of fixes that landed in zig-master and can be removed with zig-0.11 release.

Additionally, make sure we link statically against LLVM to avoid unpleasant runtime surprises originating from mixing static and dynamic LLVM libraries.

Finally, unbreak Zig 0.10.1 on macOS.

cc @winterqt


Closes #214545.

Description of changes
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.

@kubkon kubkon force-pushed the kubkon-zig-0.10-fixes branch from 33694ed to 9b9d509 Compare March 14, 2023 10:37
@kubkon kubkon changed the title zig: add patch fixing alignment panics when building zig zig: 0.10 fix macOS build Mar 14, 2023
@wegank
Copy link
Member

wegank commented Mar 14, 2023

@ofborg build zig_0_10

@wegank wegank changed the title zig: 0.10 fix macOS build zig_0_10: fix macOS build Mar 14, 2023
@ofborg ofborg bot requested review from andrewrk, aiotter and AndersonTorres March 14, 2023 10:51
@wegank wegank requested review from winterqt and strager March 14, 2023 10:59
@wegank
Copy link
Member

wegank commented Mar 14, 2023

@ofborg build ncdu

@zowoq
Copy link
Contributor

zowoq commented Mar 14, 2023

Can make 0.10 the default on darwin as well.

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a0d1e76e1c3..62a5de4e4df 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24198,8 +24198,7 @@ with pkgs;
   zig_0_10 = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig/0.10.nix {
     llvmPackages = llvmPackages_15;
   };
-  # Zig 0.10.1 is broken on Darwin, so use 0.9.1 on Darwin instead.
-  zig = if stdenv.isDarwin then zig_0_9 else zig_0_10;
+  zig = zig_0_10;
 
   zimlib = callPackage ../development/libraries/zimlib { };
 

Relevant upstream issue: ziglang/zig#14559

The patch is a backport of fixes that landed in zig-master and can
be removed with zig-0.11 release.

Additionally, make sure we link statically against LLVM to avoid
unpleasant runtime surprises originating from mixing static and
dynamic LLVM libraries.

Finally, unbreak Zig 0.10.1 on macOS.
@kubkon kubkon force-pushed the kubkon-zig-0.10-fixes branch from 9b9d509 to 18c80c1 Compare March 14, 2023 13:03
@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Mar 14, 2023
@kubkon
Copy link
Contributor Author

kubkon commented Mar 14, 2023

Can make 0.10 the default on darwin as well.

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a0d1e76e1c3..62a5de4e4df 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24198,8 +24198,7 @@ with pkgs;
   zig_0_10 = darwin.apple_sdk_11_0.callPackage ../development/compilers/zig/0.10.nix {
     llvmPackages = llvmPackages_15;
   };
-  # Zig 0.10.1 is broken on Darwin, so use 0.9.1 on Darwin instead.
-  zig = if stdenv.isDarwin then zig_0_9 else zig_0_10;
+  zig = zig_0_10;
 
   zimlib = callPackage ../development/libraries/zimlib { };
 

Done!

@wegank
Copy link
Member

wegank commented Mar 14, 2023

I haven't been able to build Zig on my machine, and I now think it's probably because I have XCode Command Line Tools installed. Since the builds succeed on ofborg, I assume that merging this PR is fine.

@wegank
Copy link
Member

wegank commented Mar 14, 2023

@ofborg eval

@wegank wegank merged commit 43fd64e into NixOS:master Mar 15, 2023
@kubkon kubkon deleted the kubkon-zig-0.10-fixes branch March 15, 2023 19:51
@Janik-Haag Janik-Haag added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jun 13, 2023
@winterqt winterqt mentioned this pull request Apr 16, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ncdu fails to build on darwin
4 participants