From de2e77ec98e3686f31452003a4164a3740f1bd19 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Wed, 22 Dec 2021 10:14:51 -0500 Subject: [PATCH 1/5] gambit: disable stackprotector on aarch64-darwin for now --- pkgs/development/compilers/gambit/bootstrap.nix | 9 +++++++++ pkgs/development/compilers/gambit/build.nix | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pkgs/development/compilers/gambit/bootstrap.nix b/pkgs/development/compilers/gambit/bootstrap.nix index ec963ab3b8d4..96e0acdc1fa7 100644 --- a/pkgs/development/compilers/gambit/bootstrap.nix +++ b/pkgs/development/compilers/gambit/bootstrap.nix @@ -15,6 +15,15 @@ gccStdenv.mkDerivation { buildInputs = [ autoconf ]; + # disable stackprotector on aarch64-darwin for now + # build error: + # ``` + # /private/tmp/nix-build-gambit-bootstrap-4.9.3.drv-0/ccbOVwnF.s:207:15: error: index must be an integer in range [-256, 255]. + # ldr x2, [x2, ___stack_chk_guard];momd + # ^ + # ``` + hardeningDisable = lib.optionals (gccStdenv.isAarch64 && gccStdenv.isDarwin) [ "stackprotector" ]; + configurePhase = '' export CC=${gcc}/bin/gcc CXX=${gcc}/bin/g++ \ CPP=${gcc}/bin/cpp CXXCPP=${gcc}/bin/cpp LD=${gcc}/bin/ld \ diff --git a/pkgs/development/compilers/gambit/build.nix b/pkgs/development/compilers/gambit/build.nix index d67e0053bbac..e592107adeca 100644 --- a/pkgs/development/compilers/gambit/build.nix +++ b/pkgs/development/compilers/gambit/build.nix @@ -35,6 +35,15 @@ gccStdenv.mkDerivation rec { # Or wrap relevant programs to add a suitable PATH ? #runtimeDeps = [ gnused gnugrep ]; + # disable stackprotector on aarch64-darwin for now + # build error: + # ``` + # /private/tmp/nix-build-gambit-unstable-2020-09-20.drv-0/ccIjyeeb.s:207:15: error: index must be an integer in range [-256, 255]. + # ldr x2, [x2, ___stack_chk_guard];momd + # ^ + # ``` + hardeningDisable = lib.optionals (gccStdenv.isAarch64 && gccStdenv.isDarwin) [ "stackprotector" ]; + configureFlags = [ "--enable-targets=${gambit-params.targets}" "--enable-single-host" From 9cee4bccd1052d3e98d9b805dbba343fb649e287 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Wed, 22 Dec 2021 10:17:45 -0500 Subject: [PATCH 2/5] gambit: bootstrap install gsc-boot --- pkgs/development/compilers/gambit/bootstrap.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gambit/bootstrap.nix b/pkgs/development/compilers/gambit/bootstrap.nix index 96e0acdc1fa7..b81e64eaac32 100644 --- a/pkgs/development/compilers/gambit/bootstrap.nix +++ b/pkgs/development/compilers/gambit/bootstrap.nix @@ -42,7 +42,7 @@ gccStdenv.mkDerivation { ''; installPhase = '' - cp -fa ./ $out/gambit/ + cp -fa ./gsc-boot $out/gambit/ ''; forceShare = [ "info" ]; From feb2dcf2c19b078e718740ec02eaeb5059fa156c Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Wed, 22 Dec 2021 10:51:10 -0500 Subject: [PATCH 3/5] leveldb: 1.20 -> 1.23 --- .../development/libraries/leveldb/default.nix | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/pkgs/development/libraries/leveldb/default.nix b/pkgs/development/libraries/leveldb/default.nix index 2a7fb196ea68..ad7e406e72ba 100644 --- a/pkgs/development/libraries/leveldb/default.nix +++ b/pkgs/development/libraries/leveldb/default.nix @@ -1,39 +1,50 @@ -{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames, snappy }: +{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames, snappy, cmake +, static ? stdenv.hostPlatform.isStatic }: stdenv.mkDerivation rec { pname = "leveldb"; - version = "1.20"; + version = "1.23"; src = fetchFromGitHub { owner = "google"; repo = "leveldb"; - rev = "v${version}"; - sha256 = "01kxga1hv4wp94agx5vl3ybxfw5klqrdsrb6p6ywvnjmjxm8322y"; + rev = "${version}"; + sha256 = "sha256-RL+dfSFZZzWvUobSqiPbuC4nDiGzjIIukbVJZRacHbI="; }; + outputs = [ "out" "dev" ]; + buildInputs = [ snappy ]; - nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames; + nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames ++ [ cmake ]; doCheck = true; buildFlags = [ "all" ]; + # NOTE: disabling tests due to gtest issue + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" + "-DCMAKE_SKIP_BUILD_RPATH=OFF" + "-DLEVELDB_BUILD_TESTS=OFF" + ]; + postPatch = lib.optionalString stdenv.hostPlatform.isStatic '' # remove shared objects from "all" target sed -i '/^all:/ s/$(SHARED_LIBS) $(SHARED_PROGRAMS)//' Makefile ''; - installPhase = '' - runHook preInstall - - install -D -t $out/include/leveldb include/leveldb/* - install -D helpers/memenv/memenv.h $out/include/leveldb/helpers - - install -D -t $out/lib out-{static,shared}/lib* - install -D -t $out/bin out-static/{leveldbutil,db_bench} - - runHook postInstall + postInstall = '' + substituteInPlace "$out"/lib/cmake/leveldb/leveldbTargets.cmake \ + --replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"' + mkdir -p $dev/lib/pkgconfig + cat < $dev/lib/pkgconfig/leveldb.pc + Name: leveldb + Description: Fast and lightweight key/value database library by Google. + Version: ${version} + Libs: -L$out/lib -lleveldb + Cflags: -I$dev/include + EOF ''; meta = with lib; { From 4cd5481f71a76e331ea04101c1656a6b8090d2d1 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Wed, 22 Dec 2021 10:52:27 -0500 Subject: [PATCH 4/5] gerbil: disable stackprotector on aarch64-darwin for now --- pkgs/development/compilers/gerbil/build.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/compilers/gerbil/build.nix b/pkgs/development/compilers/gerbil/build.nix index 3d2fd7551e67..040f17ff2850 100644 --- a/pkgs/development/compilers/gerbil/build.nix +++ b/pkgs/development/compilers/gerbil/build.nix @@ -21,6 +21,15 @@ stdenv.mkDerivation rec { buildInputs = [ gambit ] ++ buildInputs_libraries; # ++ buildInputs_staticLibraries; + # disable stackprotector on aarch64-darwin for now + # build error: + # ``` + # /private/tmp/nix-build-gerbil-unstable-2020-11-05.drv-0/ccjyhWKi.s:326:15: error: index must be an integer in range [-256, 255]. + # ldr x2, [x2, ___stack_chk_guard];momd + # ^ + # ``` + hardeningDisable = lib.optionals (gccStdenv.isAarch64 && gccStdenv.isDarwin) [ "stackprotector" ]; + NIX_CFLAGS_COMPILE = "-I${libmysqlclient}/include/mysql -L${libmysqlclient}/lib/mysql"; postPatch = '' From 064e5d108515a7ab7047ca8c2e177c0a2f796bd5 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Wed, 22 Dec 2021 17:33:38 -0500 Subject: [PATCH 5/5] irrlicht: mac_device patch nil -> 0 --- .../libraries/irrlicht/mac_device.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkgs/development/libraries/irrlicht/mac_device.patch b/pkgs/development/libraries/irrlicht/mac_device.patch index dc68c509975c..2cd402938286 100644 --- a/pkgs/development/libraries/irrlicht/mac_device.patch +++ b/pkgs/development/libraries/irrlicht/mac_device.patch @@ -18,3 +18,21 @@ [NSBundle loadNibNamed:@"MainMenu" owner:[NSApp delegate]]; [NSApp finishLaunching]; } +@@ -642,7 +642,7 @@ + NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias, + NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0), + NSOpenGLPFADoubleBuffer, +- (NSOpenGLPixelFormatAttribute)nil ++ (NSOpenGLPixelFormatAttribute)0 + }; + + if (CreationParams.AntiAlias<2) +@@ -668,7 +668,7 @@ + { + // Third try without Doublebuffer + os::Printer::log("No doublebuffering available.", ELL_WARNING); +- windowattribs[14]=(NSOpenGLPixelFormatAttribute)nil; ++ windowattribs[14]=(NSOpenGLPixelFormatAttribute)0; + } + + format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];