From 89ce6bd66993fabe7997a4236372cbd14f7ba3cd Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Thu, 13 Jun 2024 18:59:52 +0000 Subject: [PATCH 1/7] glog: 0.6.0 -> 0.7.1 Release: https://github.com/google/glog/releases/tag/v0.7.1 - split development output (which reduces closure size for downstream) - enable strictDeps (which aids in cross-compiling) - convert sha256 into hash - nixfmt format - order entries by phases and alphabet - meta: add changelog and remove nested with --- pkgs/development/libraries/glog/default.nix | 102 +++++++++++++------- 1 file changed, 65 insertions(+), 37 deletions(-) diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/development/libraries/glog/default.nix index ac425092128c6..3b517cd826a23 100644 --- a/pkgs/development/libraries/glog/default.nix +++ b/pkgs/development/libraries/glog/default.nix @@ -1,21 +1,28 @@ -{ stdenv, lib, fetchFromGitHub, cmake, gflags, gtest, perl }: +{ + cmake, + fetchFromGitHub, + gflags, + gtest, + lib, + perl, + stdenv, +}: stdenv.mkDerivation rec { pname = "glog"; - version = "0.6.0"; + version = "0.7.1"; src = fetchFromGitHub { owner = "google"; repo = "glog"; rev = "v${version}"; - sha256 = "sha256-xqRp9vaauBkKz2CXbh/Z4TWqhaUtqfbsSlbYZR/kW9s="; + hash = "sha256-+nwWP6VBmhgU7GCPSEGUzvUSCc48wXME181WpJ5ABP4="; }; - nativeBuildInputs = [ cmake ]; - - buildInputs = [ gtest ]; - - propagatedBuildInputs = [ gflags ]; + outputs = [ + "dev" + "out" + ]; cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" @@ -26,37 +33,54 @@ stdenv.mkDerivation rec { "-DWITH_UNWIND=OFF" ]; - doCheck = true; - - # There are some non-thread safe tests that can fail - enableParallelChecking = false; - nativeCheckInputs = [ perl ]; - env.GTEST_FILTER = let - filteredTests = lib.optionals stdenv.hostPlatform.isMusl [ - "Symbolize.SymbolizeStackConsumption" - "Symbolize.SymbolizeWithDemanglingStackConsumption" - ] ++ lib.optionals stdenv.hostPlatform.isStatic [ - "LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled" - ] ++ lib.optionals stdenv.cc.isClang [ - # Clang optimizes an expected allocation away. - # See https://github.com/google/glog/issues/937 - "DeathNoAllocNewHook.logging" - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - "LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled" - ]; + filteredTests = + lib.optionals stdenv.hostPlatform.isMusl [ + "Symbolize.SymbolizeStackConsumption" + "Symbolize.SymbolizeWithDemanglingStackConsumption" + ] + ++ lib.optionals stdenv.hostPlatform.isStatic [ + "LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled" + ] + ++ lib.optionals stdenv.cc.isClang [ + # Clang optimizes an expected allocation away. + # See https://github.com/google/glog/issues/937 + "DeathNoAllocNewHook.logging" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "LogBacktraceAt.DoesBacktraceAtRightLineWhenEnabled" + ]; in "-${builtins.concatStringsSep ":" filteredTests}"; + # Non-thread safe tests can fail + enableParallelChecking = false; + + strictDeps = true; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ gtest ]; + + propagatedBuildInputs = [ gflags ]; + + doCheck = true; + + nativeCheckInputs = [ perl ]; + checkPhase = let - excludedTests = lib.optionals stdenv.hostPlatform.isDarwin [ - "mock-log" - ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ - "logging" # works around segfaults on aarch64-darwin for now - ]; - excludedTestsRegex = lib.optionalString (excludedTests != [ ]) "(${lib.concatStringsSep "|" excludedTests})"; + excludedTests = + lib.optionals stdenv.hostPlatform.isDarwin [ + "mock-log" + ] + ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ + "logging" # works around segfaults on aarch64-darwin for now + ]; + excludedTestsRegex = lib.optionalString ( + excludedTests != [ ] + ) "(${lib.concatStringsSep "|" excludedTests})"; in '' runHook preCheck @@ -64,11 +88,15 @@ stdenv.mkDerivation rec { runHook postCheck ''; - meta = with lib; { - homepage = "https://github.com/google/glog"; - license = licenses.bsd3; + meta = { description = "Library for application-level logging"; - platforms = platforms.unix; - maintainers = with maintainers; [ nh2 r-burns ]; + changelog = "https://github.com/google/glog/releases/tag/v${version}"; + homepage = "https://github.com/google/glog"; + license = lib.licenses.bsd3; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ + nh2 + r-burns + ]; }; } From cff6f5760680e0d4264a0a596e174cc4b6af278b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Sun, 23 Jun 2024 13:58:56 +0000 Subject: [PATCH 2/7] glog: Enable pkg-config files --- pkgs/development/libraries/glog/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/development/libraries/glog/default.nix index 3b517cd826a23..a06d08916c985 100644 --- a/pkgs/development/libraries/glog/default.nix +++ b/pkgs/development/libraries/glog/default.nix @@ -31,6 +31,12 @@ stdenv.mkDerivation rec { # consumers of the CMake config file to fail at the configuration step. # Explicitly disabling unwind support sidesteps the issue. "-DWITH_UNWIND=OFF" + # Upstream disabled generation of pkg-config `.pc` files since + # https://github.com/google/glog/releases/tag/v0.7.0 + # because they are "undocumented and untested". + # Non-C++ dependents (that thus can't use CMake) may need them though + # to find `glog`, so we enable them. + "-DWITH_PKGCONFIG=ON" ]; env.GTEST_FILTER = From 0453ec278de3edd9d208b092c679d16d2f6b1b95 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 16 Oct 2024 22:36:20 -0300 Subject: [PATCH 3/7] glog: pkgs/by-name migration --- .../libraries/glog/default.nix => by-name/gl/glog/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{development/libraries/glog/default.nix => by-name/gl/glog/package.nix} (100%) diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/by-name/gl/glog/package.nix similarity index 100% rename from pkgs/development/libraries/glog/default.nix rename to pkgs/by-name/gl/glog/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aaa98965e1ddf..b734a46d362d0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19839,8 +19839,6 @@ with pkgs; glm = callPackage ../development/libraries/glm { }; - glog = callPackage ../development/libraries/glog { }; - gloox = callPackage ../development/libraries/gloox { }; glpk = callPackage ../development/libraries/glpk { }; From f21f0f6131fdd9660a8802f5adccbbc9341886e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Sun, 23 Jun 2024 14:50:09 +0000 Subject: [PATCH 4/7] folly: Fix build with glog >= 0.7.0 --- pkgs/development/libraries/folly/default.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/development/libraries/folly/default.nix b/pkgs/development/libraries/folly/default.nix index 8a601382f8ead..bb72dd2f3a9c6 100644 --- a/pkgs/development/libraries/folly/default.nix +++ b/pkgs/development/libraries/folly/default.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchFromGitHub +, fetchpatch , boost , cmake , double-conversion @@ -35,6 +36,21 @@ stdenv.mkDerivation rec { sha256 = "sha256-INvWTw27fmVbKQIT9ebdRGMCOIzpc/NepRN2EnKLJx0="; }; + patches = [ + # Fix incorrect include of glog >= 0.7.0, see https://github.com/facebook/folly/issues/2171 + (fetchpatch { + name = "folly-fix-cmake-find-glog.patch"; + url = "https://aur.archlinux.org/cgit/aur.git/plain/fix-cmake-find-glog.patch?h=folly&id=4b68f47338d4b20111e3ffa1291433120bb899f0"; + hash = "sha256-QGNpS5UNEm+0PW9+agwUVILzpK9t020KXDGyP03OAwE="; + }) + # Fix missing includes with glog >= 0.7.0, see https://github.com/facebook/folly/pull/2245 + (fetchpatch { + name = "folly-symbolizer-Fix-missing-unistd-h-include.patch"; + url = "https://github.com/facebook/folly/commit/f64cfb8aca569c1259c1e202861281b4704565c6.patch"; + hash = "sha256-j1uV0JDFsMReCG7XVVADwW1f/2PICYzqdyfEjP314Dg="; + }) + ]; + nativeBuildInputs = [ cmake pkg-config From 3781a1e44d1320e60d9ebbbac1f1d4204b321efe Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:00:02 -0300 Subject: [PATCH 5/7] caffe: fix build for glog 0.7.1 --- pkgs/applications/science/math/caffe/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/science/math/caffe/default.nix b/pkgs/applications/science/math/caffe/default.nix index f82cef9d881cb..08fceeb3b580f 100644 --- a/pkgs/applications/science/math/caffe/default.nix +++ b/pkgs/applications/science/math/caffe/default.nix @@ -102,6 +102,11 @@ stdenv.mkDerivation rec { }); postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "# ---[ Flags" \ + "# ---[ Flags + add_compile_definitions(GLOG_USE_GLOG_EXPORT)" + substituteInPlace src/caffe/util/io.cpp --replace \ 'SetTotalBytesLimit(kProtoReadBytesLimit, 536870912)' \ 'SetTotalBytesLimit(kProtoReadBytesLimit)' From 7d47e4016feb520dd28ecf7b50a54d292881e65e Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:09:28 -0300 Subject: [PATCH 6/7] lomiri.trust-store: fix build for glog 0.7.1 --- pkgs/desktops/lomiri/development/trust-store/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/desktops/lomiri/development/trust-store/default.nix b/pkgs/desktops/lomiri/development/trust-store/default.nix index 0e86eac2d6101..9610397d50c2c 100644 --- a/pkgs/desktops/lomiri/development/trust-store/default.nix +++ b/pkgs/desktops/lomiri/development/trust-store/default.nix @@ -42,6 +42,11 @@ stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace-fail "option(ENABLE_WERROR \"Treat all build warnings as errors\" ON)" \ + "option(ENABLE_WERROR \"Treat all build warnings as errors\" ON) + add_compile_definitions(GLOG_USE_GLOG_EXPORT)" + # pkg-config patching hook expects prefix variable substituteInPlace data/trust-store.pc.in \ --replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}' \ From 54b1daf123045a460f3f7b29bbbcaae1cb829443 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:14:23 -0300 Subject: [PATCH 7/7] python3Packages.opensfm: fix build for glog 0.7.1 --- pkgs/development/python-modules/opensfm/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/python-modules/opensfm/default.nix b/pkgs/development/python-modules/opensfm/default.nix index bfaa8b8f1b73e..a8ca0fc5ab2e3 100644 --- a/pkgs/development/python-modules/opensfm/default.nix +++ b/pkgs/development/python-modules/opensfm/default.nix @@ -55,6 +55,11 @@ buildPythonPackage rec { ./fix-scripts.patch ]; postPatch = '' + substituteInPlace opensfm/src/CMakeLists.txt \ + --replace-fail "####### Find Dependencies #######" \ + "####### Find Dependencies ####### + add_compile_definitions(GLOG_USE_GLOG_EXPORT)" + rm opensfm/src/cmake/FindGlog.cmake rm opensfm/src/cmake/FindGflags.cmake