From 0691d66e8de00b273a7ee4dd5d016885a40951a9 Mon Sep 17 00:00:00 2001 From: Angel J <78835633+iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 07:23:52 -0700 Subject: [PATCH 1/8] perlPackages.MathPari: fix build with gcc15 --- pkgs/top-level/perl-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index ffa9b81a9663..cfb0c3f2313f 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -20925,7 +20925,7 @@ with self; # Workaround build failure on -fno-common toolchains: # ld: libPARI/libPARI.a(compat.o):(.bss+0x8): multiple definition of # `overflow'; Pari.o:(.bss+0x80): first defined here - env.NIX_CFLAGS_COMPILE = "-fcommon -Wno-error=implicit-int -Wno-error=implicit-function-declaration"; + env.NIX_CFLAGS_COMPILE = "-std=gnu17 -fcommon -Wno-error=implicit-int -Wno-error=implicit-function-declaration"; preConfigure = "cp ${pari_tgz} pari-${pariversion}.tar.gz"; makeMakerFlags = [ "pari_tgz=pari-${pariversion}.tar.gz" ]; src = fetchurl { From 2f7b99c2378ca12298a805822e71a849dc808458 Mon Sep 17 00:00:00 2001 From: Angel J <78835633+iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 08:39:45 -0700 Subject: [PATCH 2/8] perlPackages.libapreq2: fix build --- pkgs/top-level/perl-packages.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index cfb0c3f2313f..48de9517bc83 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -18617,6 +18617,8 @@ with self; hash = "sha256-BGSH8ITBL6HIIq/8X33lbv7ZtIkFpCbmMaa5ScEU2Gw="; }; outputs = [ "out" ]; + # Keep generated XS code stable across rebuilds. + env.PERL_HASH_SEED = "0"; buildInputs = [ pkgs.apacheHttpd pkgs.apr @@ -18625,6 +18627,8 @@ with self; ExtUtilsXSBuilder ]; propagatedBuildInputs = [ (pkgs.apacheHttpdPackages.mod_perl.override { inherit perl; }) ]; + # Avoid libtool misdetecting gcc as the linker. + configureFlags = [ "LD=ld" ]; makeMakerFlags = [ "--with-apache2-src=${pkgs.apacheHttpd.dev}" "--with-apache2-apxs=${pkgs.apacheHttpd.dev}/bin/apxs" @@ -18634,10 +18638,10 @@ with self; ]; preConfigure = '' # override broken prereq check - substituteInPlace configure --replace "prereq_check=\"\$PERL \$PERL_OPTS build/version_check.pl\"" "prereq_check=\"echo\"" + substituteInPlace configure --replace-fail "prereq_check=\"\$PERL \$PERL_OPTS build/version_check.pl\"" "prereq_check=\"echo\"" ''; preBuild = '' - substituteInPlace apreq2-config --replace "dirname" "${pkgs.coreutils}/bin/dirname" + substituteInPlace apreq2-config --replace-fail "dirname" "${pkgs.coreutils}/bin/dirname" ''; installPhase = '' mkdir $out @@ -18666,6 +18670,8 @@ with self; rm -r $out/nix ''; doCheck = false; # test would need to start apache httpd + # Apache::Test resolves localhost while generating glue/perl (Makefile.PL / t/TEST). + __darwinAllowLocalNetworking = true; meta = { description = "Wrapper for libapreq2's module/handle API"; license = with lib.licenses; [ asl20 ]; From 5b6fe4a650cc0b1521d6e199b267103d680c1ee2 Mon Sep 17 00:00:00 2001 From: Angel J <78835633+Iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 10:04:38 -0700 Subject: [PATCH 3/8] perlPackages.MathPari: fix Darwin callback ABI --- .../Math-Pari-darwin-callback-abi.patch | 77 +++++++++++++++++++ pkgs/top-level/perl-packages.nix | 3 + 2 files changed, 80 insertions(+) create mode 100644 pkgs/development/perl-modules/Math-Pari-darwin-callback-abi.patch diff --git a/pkgs/development/perl-modules/Math-Pari-darwin-callback-abi.patch b/pkgs/development/perl-modules/Math-Pari-darwin-callback-abi.patch new file mode 100644 index 000000000000..ff5fe4984dfb --- /dev/null +++ b/pkgs/development/perl-modules/Math-Pari-darwin-callback-abi.patch @@ -0,0 +1,77 @@ +--- a/Pari.xs ++++ b/Pari.xs +@@ -1518,21 +1518,63 @@ + } + + GEN +-callPerlFunction(PerlFunctionArg1 long_ep, ...) +-{ +- GEN res; ++callPerlFunction_args(PerlFunctionArg1 long_ep, GEN *args) ++{ + entree *ep = toEntreeP(long_ep); +- va_list args; + SV *cv = (SV*) ep->elt_CV; + int numargs = CV_NUMARGS_get(cv); +- +- va_start(args, long_ep); +-/* warn("calling with numargs=%d", numargs); */ +- res = callPerlFunction_va_list(G_SCALAR, numargs, cv, args); +-/* warn("ending call"); */ +- va_end(args); +-/* warn("ended call"); */ ++ GEN res; ++ int i; ++ dSP; ++ int count; ++ pari_sp oldavma = avma; ++ SV *oPariStack = PariStack; ++ SV *sv; ++ ++ ENTER; ++ SAVETMPS; ++ SAVEINT(sentinel); ++ sentinel = avma; ++ PUSHMARK(sp); ++ EXTEND(sp, numargs + 1); ++ for (i = 0; i < numargs; i++) ++ PUSHs(pari2mortalsv(args[i], oldavma)); ++ PUTBACK; ++ count = perl_call_sv(cv, G_SCALAR); ++ ++ SPAGAIN; ++ if (count != 1) ++ croak("Perl function exported into PARI returns unexpected number %d of values (need 1)", count); ++ ++ sv = SvREFCNT_inc(POPs); ++ ++ PUTBACK; ++ FREETMPS; ++ LEAVE; ++ ++ if (PariStack != oPariStack) ++ moveoffstack_newer_than(oPariStack); ++ res = sv2pari(sv); ++ res = myforcecopy(res); ++ SvREFCNT_dec(sv); ++ + return res; ++} ++ ++GEN ++callPerlFunction(PerlFunctionArg1 long_ep, GEN arg0, GEN arg1, GEN arg2, GEN arg3, GEN arg4, GEN arg5, GEN arg6, GEN arg7) ++{ ++ GEN args[8]; ++ ++ args[0] = arg0; ++ args[1] = arg1; ++ args[2] = arg2; ++ args[3] = arg3; ++ args[4] = arg4; ++ args[5] = arg5; ++ args[6] = arg6; ++ args[7] = arg7; ++ return callPerlFunction_args(long_ep, args); + } + + entree * diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 48de9517bc83..ec46a501bfa4 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -20938,6 +20938,9 @@ with self; url = "mirror://cpan/authors/id/I/IL/ILYAZ/modules/Math-Pari-2.030528.tar.gz"; hash = "sha256-Z/dNIWxpY1qxxuo+J84ZdQqUorVgrnKIuy1s9xT85sg="; }; + patches = lib.optionals stdenv.hostPlatform.isDarwin [ + ../development/perl-modules/Math-Pari-darwin-callback-abi.patch + ]; meta = { description = "Perl interface to PARI"; license = with lib.licenses; [ From ec077bf10c0e76266a370cd26ee8489f7778f3f5 Mon Sep 17 00:00:00 2001 From: Angel J <78835633+Iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 10:20:48 -0700 Subject: [PATCH 4/8] perlPackages.BerkeleyDB: fix build by pinning to db4 db-5.3 breaks the mutex/environment tests; db4 succeeds. --- pkgs/top-level/perl-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index ec46a501bfa4..daabcabad782 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -2416,8 +2416,8 @@ with self; }; preConfigure = '' - echo "LIB = ${pkgs.db.out}/lib" > config.in - echo "INCLUDE = ${pkgs.db.dev}/include" >> config.in + echo "LIB = ${pkgs.db4.out}/lib" > config.in + echo "INCLUDE = ${pkgs.db4.dev}/include" >> config.in ''; meta = { description = "Perl extension for Berkeley DB version 2, 3, 4, 5 or 6"; From 1b1aaaed60b89e2424d946dbfeee7884a15979d4 Mon Sep 17 00:00:00 2001 From: Angel J <78835633+Iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 11:05:41 -0700 Subject: [PATCH 5/8] perlPackages.SocketNetlink: disable unsupported darwin build --- pkgs/top-level/perl-packages.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index daabcabad782..828fe15cd448 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -30871,6 +30871,7 @@ with self; artistic1 gpl1Plus ]; + platforms = lib.platforms.linux; # configure probes PF_NETLINK; unavailable on Darwin }; }; From 15183f7428a3882a7d8aa11a7518263afd55550c Mon Sep 17 00:00:00 2001 From: Angel J <78835633+Iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 11:17:11 -0700 Subject: [PATCH 6/8] perlPackages.NetPing: remove external-network syn tests for sandbox builds --- pkgs/top-level/perl-packages.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 828fe15cd448..35c9fd88ad80 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -25936,6 +25936,11 @@ with self; url = "mirror://cpan/authors/id/R/RU/RURBAN/Net-Ping-2.75.tar.gz"; hash = "sha256-tH3zz9lpLM0Aca05/nRxjrwy9ZcBVWpgT9FaCfCeDXQ="; }; + preCheck = '' + # On Linux these are skipped early ("no echo port"); on Darwin they proceed and + # hit external DNS (www.about.com), which fails in the sandbox. + rm -f t/400_ping_syn.t t/410_syn_host.t + ''; meta = { description = "Check a remote host for reachability"; license = with lib.licenses; [ From cddded608f4b1b27ff5cc687a90d95e617f2f243 Mon Sep 17 00:00:00 2001 From: Angel J <78835633+Iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 11:26:25 -0700 Subject: [PATCH 7/8] perlPackages.CryptOpenSSLAES: fix Darwin build (pin OpenSSL prefix) Set OPENSSL_PREFIX so Makefile.PL finds Nix openssl only; avoids macOS mixing system libcrypto and aborting during configure. --- pkgs/top-level/perl-packages.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 35c9fd88ad80..b0fcca553b30 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -7581,6 +7581,9 @@ with self; ]; env.NIX_CFLAGS_COMPILE = "-I${pkgs.openssl.dev}/include"; env.NIX_CFLAGS_LINK = "-L${lib.getLib pkgs.openssl}/lib -lcrypto"; + # Needed on Darwin so Crypt::OpenSSL::Guess does not pick /usr/bin/openssl and mix + # system libcrypto with the Nix one (perl aborts: "loading libcrypto in an unsafe way"). + env.OPENSSL_PREFIX = pkgs.openssl; meta = { description = "Perl wrapper around OpenSSL's AES library"; license = with lib.licenses; [ From a46253dc772488afbed9ca9f66b236f8f295064f Mon Sep 17 00:00:00 2001 From: Angel J <78835633+Iamanaws@users.noreply.github.com> Date: Wed, 6 May 2026 12:25:46 -0700 Subject: [PATCH 8/8] perlPackages.BoostGeometryUtils: fix Darwin build Patch the bundled Boost numeric conversion enum wrappers on Darwin, where modern Clang rejects the old Boost.MPL enum constants. Also force the XS C++ compile to C++14 to avoid newer C++ mode incompatibilities. --- pkgs/top-level/perl-packages.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index b0fcca553b30..23d07a30c03d 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -2656,6 +2656,34 @@ with self; # Fix out of memory error on Perl 5.19.4 and later. ../development/perl-modules/boost-geometry-utils-fix-oom.patch ]; + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + # Clang on Darwin defaults to a newer C++ mode where the old bundled Boost + # headers no longer compile. + substituteInPlace Build.PL \ + --replace-fail "extra_compiler_flags => [qw(-DHAS_BOOL)]" \ + "extra_compiler_flags => [qw(-DHAS_BOOL -std=c++14)]" + + # Avoid Boost.MPL enum wrappers that modern Clang rejects as out-of-range + # enum constant expressions. + substituteInPlace src/boost/numeric/conversion/detail/int_float_mixture.hpp \ + --replace-fail '#include "boost/mpl/integral_c.hpp"' "" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" \ + --replace-fail "mpl::integral_c" "int_float_mixture_constant" + perl -i -pe 'if ($. == 22) { $_ .= " template struct int_float_mixture_constant { static const int_float_mixture_enum value = v; typedef int_float_mixture_constant type; typedef int_float_mixture_enum value_type; operator int_float_mixture_enum() const { return value; } };\n" }' \ + src/boost/numeric/conversion/detail/int_float_mixture.hpp + + # Same workaround for the user-defined-type/builtin-type conversion enum. + substituteInPlace src/boost/numeric/conversion/detail/udt_builtin_mixture.hpp \ + --replace-fail '#include "boost/mpl/integral_c.hpp"' "" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" \ + --replace-fail "mpl::integral_c" "udt_builtin_mixture_constant" + perl -i -pe 'if ($. == 21) { $_ .= " template struct udt_builtin_mixture_constant { static const udt_builtin_mixture_enum value = v; typedef udt_builtin_mixture_constant type; typedef udt_builtin_mixture_enum value_type; operator udt_builtin_mixture_enum() const { return value; } };\n" }' \ + src/boost/numeric/conversion/detail/udt_builtin_mixture.hpp + ''; buildInputs = [ ExtUtilsCppGuess ExtUtilsTypemapsDefault