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

x86_64-darwin: fix packages that won’t build #180931

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions pkgs/applications/emulators/bsnes/bsnes-hd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ stdenv.mkDerivation {

enableParallelBuilding = true;

makeFlags = [ "-C" "bsnes" "hiro=gtk3" "prefix=$(out)" ];
makeFlags = [ "-C" "bsnes" "prefix=$(out)" ]
++ lib.optionals stdenv.isLinux [ "hiro=gtk3" ]
++ lib.optionals stdenv.isDarwin [ "hiro=cocoa" ];

# https://github.com/bsnes-emu/bsnes/issues/107
preFixup = ''
Expand All @@ -59,9 +61,6 @@ stdenv.mkDerivation {
license = licenses.gpl3Only;
maintainers = with maintainers; [ stevebob ];
platforms = platforms.unix;
# ../nall/traits.hpp:19:14: error: no member named 'is_floating_point_v' in namespace 'std'; did you mean 'is_floating_point'?
# using std::is_floating_point_v;
broken = (stdenv.isDarwin && stdenv.isx86_64);
mainProgram = "bsnes";
};
}
7 changes: 4 additions & 3 deletions pkgs/applications/graphics/vengi-tools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ stdenv.mkDerivation rec {
"-DGAMES=OFF"
"-DMAPVIEW=OFF"
"-DAIDEBUG=OFF"
] ++ lib.optional stdenv.isDarwin "-DCORESERVICES_LIB=${CoreServices}";
] ++ lib.optionals stdenv.isDarwin [
"-DCORESERVICES_LIB=${CoreServices}"
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14"
];

# Set the data directory for each executable. We cannot set it at build time
# with the PKGDATADIR cmake variable because each executable needs a specific
Expand Down Expand Up @@ -106,7 +109,5 @@ stdenv.mkDerivation rec {
license = [ licenses.mit licenses.cc-by-sa-30 ];
maintainers = with maintainers; [ fgaz ];
platforms = platforms.all;
# Requires SDK 10.14 https://github.com/NixOS/nixpkgs/issues/101229
broken = stdenv.isDarwin && stdenv.isx86_64;
};
}
3 changes: 0 additions & 3 deletions pkgs/applications/misc/stork/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,5 @@ rustPlatform.buildRustPackage rec {
homepage = "https://github.com/jameslittle230/stork";
license = with licenses; [ asl20 ];
maintainers = with maintainers; [ chuahou ];
# TODO: Remove once nixpkgs uses macOS SDK 10.14+ for x86_64-darwin
# Undefined symbols for architecture x86_64: "_SecTrustEvaluateWithError"
broken = stdenv.isDarwin && stdenv.isx86_64;
};
}
8 changes: 6 additions & 2 deletions pkgs/applications/science/logic/aspino/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ stdenv.mkDerivation {

buildInputs = [ zlib boost ];

patches = [
# Fixes the following error when built with Clang:
# error: ordered comparison between pointer and zero ('unsigned int *' and 'int')
./pointer-comparison.patch
];

postPatch = ''
substituteInPlace Makefile \
--replace "GCC = g++" "GCC = c++"
Expand Down Expand Up @@ -47,7 +53,5 @@ stdenv.mkDerivation {
homepage = "https://alviano.net/software/maxino/";
# See pkgs/applications/science/logic/glucose/default.nix
badPlatforms = [ "aarch64-linux" ];
# src/MaxSatSolver.cc:280:62: error: ordered comparison between pointer and zero ('unsigned int *' and 'int')
broken = (stdenv.isDarwin && stdenv.isx86_64); # broken since 2019-05-07 on hydra
};
}
13 changes: 13 additions & 0 deletions pkgs/applications/science/logic/aspino/pointer-comparison.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/MaxSatSolver.cc b/src/MaxSatSolver.cc
index 9e32dac..261032d 100644
--- a/src/MaxSatSolver.cc
+++ b/src/MaxSatSolver.cc
@@ -277,7 +277,7 @@ void MaxSatSolver::bce() {
else {
for(int j = 0; j < softLiterals.size(); j++) {
if(var(softLiterals[j]) == i) {
- if(occ[i][sign(softLiterals[j])] > 0) {
+ if(occ[i][sign(softLiterals[j])] > (unsigned int *)0) {
// cout << "Pure literal: " << mkLit(i, occ[i][1].size() == 0) << endl;
addClause(mkLit(i, occ[i][1].size() == 0));
weights[i] = 0;
4 changes: 0 additions & 4 deletions pkgs/development/compilers/bigloo/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ stdenv.mkDerivation rec {
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ thoughtpolice ];
# dyld: Library not loaded: /nix/store/w3liqjlrcmzc0sf2kgwjprqgqwqx8z47-libunistring-1.0/lib/libunistring.2.dylib
# Referenced from: /private/tmp/nix-build-bigloo-4.4b.drv-0/bigloo-4.4b/bin/bigloo
# Reason: Incompatible library version: bigloo requires version 5.0.0 or later, but libunistring.2.dylib provides version 4.0.0
broken = (stdenv.isDarwin && stdenv.isx86_64);

longDescription = ''
Bigloo is a Scheme implementation devoted to one goal: enabling
Expand Down
32 changes: 28 additions & 4 deletions pkgs/development/compilers/ccl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ stdenv.mkDerivation rec {
url = "https://github.com/Clozure/ccl/commit/997de91062d1f152d0c3b322a1e3694243e4a403.patch";
sha256 = "10w6zw8wgalkdyya4m48lgca4p9wgcp1h44hy9wqr94dzlllq0f6";
})
# Fix image load failure on macOS 11 and newer
(fetchpatch {
name = "macos-11-loading.patch";
url = "https://github.com/Clozure/ccl/commit/553c0f25f38b2b0d5922ca7b4f62f09eb85ace1c.patch";
sha256 = "sha256-kzSPzyykSiIUF0rASTOOvl+rkjmqE98PcBWhxLADulQ=";
})
# Fix CCL running under Rosetta 2 on aarch64-darwin
(fetchpatch {
name = "darwin-rosetta-2.patch";
url = "https://github.com/Clozure/ccl/commit/ca107b94f9e3c2aa693c14f4a4b44a11ffa65b7d.patch";
sha256 = "sha256-8xgPtEgQFdJVA8A4vyv0L+lLZH2wo2+bvHPJXxP5OZ4=";
})
# Use the clang-integrated assembler on Darwin
(fetchpatch {
name = "darwin-assembler-fix.patch";
url = "https://github.com/Clozure/ccl/commit/b321ec147ca6b1c93a01d7d35bf25092e7b1b6b1.patch";
sha256 = "sha256-2Bi55SDdFtO+KFuOglJQiU0jN16rcfkVGBhEuQKDe6M=";
})
];

buildInputs = if stdenv.isDarwin then [ bootstrap_cmds m4 ] else [ glibc m4 ];
Expand All @@ -84,7 +102,9 @@ stdenv.mkDerivation rec {
--replace "M4 = gm4" "M4 = m4" \
--replace "dtrace" "/usr/sbin/dtrace" \
--replace "/bin/rm" "${coreutils}/bin/rm" \
--replace "/bin/echo" "${coreutils}/bin/echo"
--replace "/bin/echo" "${coreutils}/bin/echo" \
--replace "AS = as" "AS = ${stdenv.cc}/bin/clang" \
--replace "ASFLAGS =" "ASFLAGS = -c -x assembler -"

substituteInPlace lisp-kernel/m4macros.m4 \
--replace "/bin/pwd" "${coreutils}/bin/pwd"
Expand All @@ -101,7 +121,13 @@ stdenv.mkDerivation rec {
make -C lisp-kernel/${CCL_KERNEL} clean
make -C lisp-kernel/${CCL_KERNEL} all

./${CCL_RUNTIME} -n -b -e '(ccl:rebuild-ccl :full t)' -e '(ccl:quit)'
# Per the release notes, it’s not possible to do a full rebuild on macOS 10.15 or newer.
./${CCL_RUNTIME} -n -b -e '(ccl:rebuild-ccl ${if stdenv.isDarwin then ":clean" else ":full"} t)' -e '(ccl:quit)'
'';

sandboxProfile = ''
(allow file-read* (subpath "/dev/dtrace") (literal "/usr/sbin/dtrace"))
(allow process-exec (literal "/usr/sbin/dtrace"))
'';

installPhase = ''
Expand All @@ -121,8 +147,6 @@ stdenv.mkDerivation rec {
homepage = "https://ccl.clozure.com/";
maintainers = with maintainers; [ raskin tohl ];
platforms = attrNames options;
# assembler failures during build, x86_64-darwin broken since 2020-10-14
broken = (stdenv.isDarwin && stdenv.isx86_64);
license = licenses.asl20;
};
}
2 changes: 1 addition & 1 deletion pkgs/development/compilers/rust/rustc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ in stdenv.mkDerivation rec {
"${setHost}.musl-root=${pkgsBuildHost.targetPackages.stdenv.cc.libc}"
] ++ optionals stdenv.targetPlatform.isMusl [
"${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}"
] ++ optionals (stdenv.isDarwin && stdenv.isx86_64) [
] ++ optionals (stdenv.isDarwin && stdenv.isx86_64 && (lib.versionOlder stdenv.targetPlatform.darwinSdkVersion "11.0")) [
# https://github.com/rust-lang/rust/issues/92173
"--set rust.jemalloc"
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/interpreters/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ in {
inherit passthruFun;
};

rustpython = callPackage ./rustpython/default.nix {
inherit (darwin.apple_sdk.frameworks) SystemConfiguration;
rustpython = darwin.apple_sdk_11_0.callPackage ./rustpython/default.nix {
inherit (darwin.apple_sdk_11_0.frameworks) SystemConfiguration;
};

})
19 changes: 10 additions & 9 deletions pkgs/development/interpreters/python/rustpython/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, fetchFromGitHub
, SystemConfiguration
, python3
, fetchpatch
}:

rustPlatform.buildRustPackage rec {
Expand All @@ -17,6 +18,15 @@ rustPlatform.buildRustPackage rec {
sha256 = "sha256-YwGfXs3A5L/18mHnnWubPU3Y8EI9uU3keJ2HJnnTwv0=";
};

patches = [
# Patched needed because this version does not build with recent versions of Rust.
# See: https://github.com/RustPython/RustPython/issues/3614
(fetchpatch {
url = "https://github.com/RustPython/RustPython/commit/61f7d241c0d7acca626a8e932b71e8ac5871362d.patch";
hash = "sha256-+2xlu+/etzCxkP/6Z1n+FwsAM6m+uPCriOoYuEI1j1U=";
})
];

cargoHash = "sha256-T85kiPG80oZ4mwpb8Ag40wDHKx2Aens+gM7NGXan5lM=";

# freeze the stdlib into the rustpython binary
Expand All @@ -31,14 +41,5 @@ rustPlatform.buildRustPackage rec {
homepage = "https://rustpython.github.io";
license = licenses.mit;
maintainers = with maintainers; [ prusnak ];

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can leave a TODO here to switch back away from the SDK when stdenv gets bumped to 10.13, if that is enough?

# TODO: Remove once nixpkgs uses newer SDKs that supports '*at' functions.
# Probably macOS SDK 10.13 or later. Check the current version in
# .../os-specific/darwin/apple-sdk/default.nix
#
# From the build logs:
#
# > Undefined symbols for architecture x86_64: "_utimensat"
broken = stdenv.isDarwin && stdenv.isx86_64;
};
}
26 changes: 26 additions & 0 deletions pkgs/development/libraries/bullet/argument-outside-range.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/src/Bullet3Common/b3Vector3.h b/src/Bullet3Common/b3Vector3.h
index 50504c7f7..dee61c400 100644
--- a/src/Bullet3Common/b3Vector3.h
+++ b/src/Bullet3Common/b3Vector3.h
@@ -39,7 +39,7 @@ subject to the following restrictions:
#endif


-#define B3_SHUFFLE(x,y,z,w) ((w)<<6 | (z)<<4 | (y)<<2 | (x))
+#define B3_SHUFFLE(x, y, z, w) (((w) << 6 | (z) << 4 | (y) << 2 | (x)) & 0xff)
//#define b3_pshufd_ps( _a, _mask ) (__m128) _mm_shuffle_epi32((__m128i)(_a), (_mask) )
#define b3_pshufd_ps( _a, _mask ) _mm_shuffle_ps((_a), (_a), (_mask) )
#define b3_splat3_ps( _a, _i ) b3_pshufd_ps((_a), B3_SHUFFLE(_i,_i,_i, 3) )
diff --git a/src/LinearMath/btVector3.h b/src/LinearMath/btVector3.h
index 8d0b73f88..f3be485da 100644
--- a/src/LinearMath/btVector3.h
+++ b/src/LinearMath/btVector3.h
@@ -39,7 +39,7 @@ subject to the following restrictions:
#endif


-#define BT_SHUFFLE(x,y,z,w) ((w)<<6 | (z)<<4 | (y)<<2 | (x))
+#define BT_SHUFFLE(x, y, z, w) (((w) << 6 | (z) << 4 | (y) << 2 | (x)) & 0xff)
//#define bt_pshufd_ps( _a, _mask ) (__m128) _mm_shuffle_epi32((__m128i)(_a), (_mask) )
#define bt_pshufd_ps( _a, _mask ) _mm_shuffle_ps((_a), (_a), (_mask) )
#define bt_splat3_ps( _a, _i ) bt_pshufd_ps((_a), BT_SHUFFLE(_i,_i,_i, 3) )
10 changes: 6 additions & 4 deletions pkgs/development/libraries/bullet/roboschool-fork.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ stdenv.mkDerivation {
buildInputs = lib.optionals stdenv.isLinux [ libGLU libGL freeglut ]
++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];

patches = [ ./gwen-narrowing.patch ];
patches = [
./gwen-narrowing.patch
# Fixes `error: argument value 10880 is outside the valid range [0, 255] [-Wargument-outside-range]` on Darwin.
# Adapted from the fork’s upstream since the fork itself has not been updated.
./argument-outside-range.patch
];

postPatch = lib.optionalString stdenv.isDarwin ''
sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
Expand Down Expand Up @@ -51,8 +56,5 @@ stdenv.mkDerivation {
homepage = "http://bulletphysics.org";
license = licenses.zlib;
platforms = platforms.unix;
# /tmp/nix-build-bullet-2019-03-27.drv-0/source/src/Bullet3Common/b3Vector3.h:297:7: error: argument value 10880 is outside the valid range [0, 255] [-Wargument-outside-range]
# y = b3_splat_ps(y, 0x80);
broken = (stdenv.isDarwin && stdenv.isx86_64);
};
}
9 changes: 0 additions & 9 deletions pkgs/development/tools/rust/cargo-deb/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ rustPlatform.buildRustPackage rec {
description = "Generate Debian packages from information in Cargo.toml";
homepage = "https://github.com/mmstick/cargo-deb";
license = licenses.mit;
# test failures:
# control::tests::generate_scripts_generates_maintainer_scripts_for_unit
# dh_installsystemd::tests::find_units_in_empty_dir_finds_nothing
# dh_lib::tests::apply_with_no_matching_files
# dh_lib::tests::debhelper_script_subst_with_generated_file_only
# dh_lib::tests::debhelper_script_subst_with_no_matching_files
# dh_lib::tests::pkgfile_finds_most_specific_match_without_pkg_file
# dh_lib::tests::pkgfile_finds_most_specific_match_without_unit_file
broken = (stdenv.isDarwin && stdenv.isx86_64);
maintainers = with maintainers; [ Br1ght0ne ];
};
}
3 changes: 0 additions & 3 deletions pkgs/development/tools/rust/cargo-modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ rustPlatform.buildRustPackage rec {
description = "A cargo plugin for showing a tree-like overview of a crate's modules";
homepage = "https://github.com/regexident/cargo-modules";
license = with licenses; [ mpl20 ];
# all tests fail with:
# thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "tests run with disabled concurrency, automatic snapshot name generation is not supported. Consider using the \"backtrace\" feature of insta which tries to recover test names from the call stack."', /private/tmp/nix-build-cargo-modules-0.5.9.drv-0/cargo-modules-0.5.9-vendor.tar.gz/insta/src/runtime.rs:908:22
broken = (stdenv.isDarwin && stdenv.isx86_64);
maintainers = with maintainers; [ figsoda rvarago ];
};
}
37 changes: 5 additions & 32 deletions pkgs/os-specific/darwin/apple-sdk-11.0/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenvNoCC, fetchurl, newScope, lib, pkgs
{ stdenvNoCC, fetchurl, newScope, lib, pkgs, buildPackages, targetPackages
, stdenv, overrideCC
, xar, cpio, python3, pbzx }:

Expand Down Expand Up @@ -46,7 +46,7 @@ let
inherit MacOSX-SDK;

Libsystem = callPackage ./libSystem.nix {};
LibsystemCross = pkgs.darwin.Libsystem;
LibsystemCross = packages.Libsystem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure this is fine? I feel like it'd have been defined as an alias before if that was the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow. Aren’t aliases for deprecated names?

This change was to correct what I believe was a mistake in the previous patch. The 11.0 SDK originally assumed that pkgs.darwin.Libsystem belongs to the SDK, but that’s not necessarily the case. On x86_64-darwin, that’s the 10.12 SDK.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I meant with an alias was rec { Libsystem = ...; LibsystemCross = Libsystem; }, not aliases.nix.

I'm really not sure how cross works in Nix. But I do suspect LibsystemCross might have to be different from Libsystem in some way, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. It’s not currently different on aarch64-darwin, so I propagated that here. I assume it works because Apple’s SDK is naturally cross-capable.

libcharset = callPackage ./libcharset.nix {};
libunwind = callPackage ./libunwind.nix {};
libnetwork = callPackage ./libnetwork.nix {};
Expand All @@ -55,35 +55,8 @@ let
# questionable aliases
configd = pkgs.darwin.apple_sdk.frameworks.SystemConfiguration;
IOKit = pkgs.darwin.apple_sdk.frameworks.IOKit;

callPackage = newScope (lib.optionalAttrs stdenv.isDarwin rec {
inherit (pkgs.darwin.apple_sdk_11_0) stdenv;
darwin = pkgs.darwin.overrideScope (_: prev: {
inherit (prev.darwin.apple_sdk_11_0) Libsystem LibsystemCross libcharset libunwind objc4 configd IOKit Security;
apple_sdk = prev.darwin.apple_sdk_11_0;
CF = prev.darwin.apple_sdk_11_0.CoreFoundation;
});
xcodebuild = pkgs.xcbuild.override {
inherit (pkgs.darwin.apple_sdk_11_0.frameworks) CoreServices CoreGraphics ImageIO;
inherit stdenv;
};
xcbuild = xcodebuild;
});

stdenv =
let
clang = stdenv.cc.override {
bintools = stdenv.cc.bintools.override { libc = packages.Libsystem; };
libc = packages.Libsystem;
};
in
if stdenv.isAarch64 then stdenv
else
(overrideCC stdenv clang).override {
targetPlatform = stdenv.targetPlatform // {
darwinMinVersion = "10.12";
darwinSdkVersion = "11.0";
};
};
} // import ./pkg-compatibility.nix {
inherit lib pkgs stdenv;
darwinPackages = packages;
};
in packages
Loading