diff options
author | toonn <toonn@toonn.io> | 2023-10-19 19:29:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 19:29:23 +0200 |
commit | 026763c623c83496187633f45e5c877772b09f37 (patch) | |
tree | f794df33e5d4fe49bf1a9b78dacad891cfe8a797 /pkgs | |
parent | 8f1823936f7cbc53da9e72a78ae5ab1cab3b130b (diff) | |
parent | 04f489ca6032d1fbaa4ce4aaaf125e3cb4c4e107 (diff) | |
download | nixpkgs-026763c623c83496187633f45e5c877772b09f37.tar nixpkgs-026763c623c83496187633f45e5c877772b09f37.tar.gz nixpkgs-026763c623c83496187633f45e5c877772b09f37.tar.bz2 nixpkgs-026763c623c83496187633f45e5c877772b09f37.tar.lz nixpkgs-026763c623c83496187633f45e5c877772b09f37.tar.xz nixpkgs-026763c623c83496187633f45e5c877772b09f37.tar.zst nixpkgs-026763c623c83496187633f45e5c877772b09f37.zip |
Merge pull request #253031 from reckenrode/pybind11-fix
python3Packages.pybind11: work around clang check
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/python-modules/pybind11/default.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pybind11/default.nix b/pkgs/development/python-modules/pybind11/default.nix index fe29cde9e52..d17bc80c809 100644 --- a/pkgs/development/python-modules/pybind11/default.nix +++ b/pkgs/development/python-modules/pybind11/default.nix @@ -12,6 +12,7 @@ , pytestCheckHook , libxcrypt , makeSetupHook +, darwin }: let setupHook = makeSetupHook { name = "pybind11-setup-hook"; @@ -22,6 +23,19 @@ pythonSitePackages = "${python}/${python.sitePackages}"; }; } ./setup-hook.sh; + + # clang 16 defaults to C++17, which results in the use of aligned allocations by pybind11. + # libc++ supports aligned allocations via `posix_memalign`, which is available since 10.6, + # but clang has a check hard-coded requiring 10.13 because that’s when Apple first shipped a + # support for C++17 aligned allocations on macOS. + # Tell clang we’re targeting 10.13 on x86_64-darwin while continuing to use the default SDK. + stdenv' = if stdenv.isDarwin && stdenv.isx86_64 + then python.stdenv.override (oldStdenv: { + buildPlatform = oldStdenv.buildPlatform // { darwinMinVersion = "10.13"; }; + targetPlatform = oldStdenv.targetPlatform // { darwinMinVersion = "10.13"; }; + hostPlatform = oldStdenv.hostPlatform // { darwinMinVersion = "10.13"; }; + }) + else python.stdenv; in buildPythonPackage rec { pname = "pybind11"; version = "2.11.1"; @@ -41,6 +55,8 @@ in buildPythonPackage rec { buildInputs = lib.optionals (pythonOlder "3.9") [ libxcrypt ]; propagatedBuildInputs = [ setupHook ]; + stdenv = stdenv'; + dontUseCmakeBuildDir = true; # Don't build tests if not needed, read the doInstallCheck value at runtime |