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)' diff --git a/pkgs/by-name/gl/glog/package.nix b/pkgs/by-name/gl/glog/package.nix new file mode 100644 index 0000000000000..a06d08916c985 --- /dev/null +++ b/pkgs/by-name/gl/glog/package.nix @@ -0,0 +1,108 @@ +{ + cmake, + fetchFromGitHub, + gflags, + gtest, + lib, + perl, + stdenv, +}: + +stdenv.mkDerivation rec { + pname = "glog"; + version = "0.7.1"; + + src = fetchFromGitHub { + owner = "google"; + repo = "glog"; + rev = "v${version}"; + hash = "sha256-+nwWP6VBmhgU7GCPSEGUzvUSCc48wXME181WpJ5ABP4="; + }; + + outputs = [ + "dev" + "out" + ]; + + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=ON" + # glog's custom FindUnwind.cmake module detects LLVM's unwind in case + # stdenv.cc is clang. But the module doesn't get installed, causing + # 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 = + 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" + ]; + 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})"; + in + '' + runHook preCheck + ctest -E "${excludedTestsRegex}" --output-on-failure + runHook postCheck + ''; + + meta = { + description = "Library for application-level logging"; + 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 + ]; + }; +} 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}' \ 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 diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/development/libraries/glog/default.nix deleted file mode 100644 index ac425092128c6..0000000000000 --- a/pkgs/development/libraries/glog/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ stdenv, lib, fetchFromGitHub, cmake, gflags, gtest, perl }: - -stdenv.mkDerivation rec { - pname = "glog"; - version = "0.6.0"; - - src = fetchFromGitHub { - owner = "google"; - repo = "glog"; - rev = "v${version}"; - sha256 = "sha256-xqRp9vaauBkKz2CXbh/Z4TWqhaUtqfbsSlbYZR/kW9s="; - }; - - nativeBuildInputs = [ cmake ]; - - buildInputs = [ gtest ]; - - propagatedBuildInputs = [ gflags ]; - - cmakeFlags = [ - "-DBUILD_SHARED_LIBS=ON" - # glog's custom FindUnwind.cmake module detects LLVM's unwind in case - # stdenv.cc is clang. But the module doesn't get installed, causing - # consumers of the CMake config file to fail at the configuration step. - # Explicitly disabling unwind support sidesteps the issue. - "-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" - ]; - in - "-${builtins.concatStringsSep ":" filteredTests}"; - - 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})"; - in - '' - runHook preCheck - ctest -E "${excludedTestsRegex}" --output-on-failure - runHook postCheck - ''; - - meta = with lib; { - homepage = "https://github.com/google/glog"; - license = licenses.bsd3; - description = "Library for application-level logging"; - platforms = platforms.unix; - maintainers = with maintainers; [ nh2 r-burns ]; - }; -} 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 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 { };