From 5cb6e6ee21431349ec31cccebf9ab9a56e904bb2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 5 Jul 2020 17:37:36 +0100 Subject: fix(3p/nix): Link to Abseil built by Nix This didn't work previously ... but now it does. I think setting the standard explicitly is what did the trick, but it's slightly unclear to me why. Either way this means that Abseil is no longer constantly getting recompiled when building Nix, which is nice. Change-Id: I377f7b68bf1ef9045df6a2eee8fdd0c92f243547 Reviewed-on: https://cl.tvl.fyi/c/depot/+/921 Tested-by: BuildkiteCI Reviewed-by: lukegb --- third_party/abseil_cpp/default.nix | 4 ++++ third_party/nix/CMakeLists.txt | 19 +------------------ third_party/nix/abseil_cpp | 1 - third_party/nix/default.nix | 2 +- 4 files changed, 6 insertions(+), 20 deletions(-) delete mode 120000 third_party/nix/abseil_cpp diff --git a/third_party/abseil_cpp/default.nix b/third_party/abseil_cpp/default.nix index ec2e996d6a45..849bbbc9d51d 100644 --- a/third_party/abseil_cpp/default.nix +++ b/third_party/abseil_cpp/default.nix @@ -7,6 +7,10 @@ in llvmPackages.libcxxStdenv.mkDerivation rec { src = ./.; nativeBuildInputs = [ cmake ]; + cmakeFlags = [ + "-DCMAKE_CXX_STANDARD=17" + ]; + meta = with lib; { description = "An open-source collection of C++ code designed to augment the C++ standard library"; homepage = https://abseil.io/; diff --git a/third_party/nix/CMakeLists.txt b/third_party/nix/CMakeLists.txt index fad650a7cade..35fc003dd77f 100644 --- a/third_party/nix/CMakeLists.txt +++ b/third_party/nix/CMakeLists.txt @@ -20,24 +20,7 @@ find_package(CURL) find_package(SQLite3) find_package(Threads) find_package(LibLZMA) - -# Abseil really doesn't like being precompiled. It is included here as -# an imported CMake project (i.e. it will be built /with/ this -# project). -# -# In development mode, the 'abseil_cpp' folder is symlinked to -# ../abseil_cpp (the relative location in the depot). In derivation -# builds this symlink is automatically replaced with an appropriate -# link to the Abseil sources in the Nix store. -add_subdirectory(abseil_cpp) -install(DIRECTORY abseil_cpp/absl - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - FILES_MATCHING - PATTERN "*.inc" - PATTERN "*.h" - PATTERN "copts" EXCLUDE - PATTERN "testdata" EXCLUDE - ) +find_package(absl REQUIRED) # Linking precompiled glog binaries (linked against libstdc++) leads # to working binaries that do not output log messages. It seems that diff --git a/third_party/nix/abseil_cpp b/third_party/nix/abseil_cpp deleted file mode 120000 index cd6434fc044a..000000000000 --- a/third_party/nix/abseil_cpp +++ /dev/null @@ -1 +0,0 @@ -../abseil_cpp/ \ No newline at end of file diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix index e6fa3f1f7d62..6ec477c63747 100644 --- a/third_party/nix/default.nix +++ b/third_party/nix/default.nix @@ -19,7 +19,6 @@ in pkgs.llvmPackages.libcxxStdenv.mkDerivation { # Abseil's sources need to be symlinked into Nix' sources. postUnpack = '' - ln -fs ${pkgs.abseil_cpp.drvAttrs.src} nix/abseil_cpp ln -fs ${pkgs.glog.drvAttrs.src} nix/glog ''; @@ -35,6 +34,7 @@ in pkgs.llvmPackages.libcxxStdenv.mkDerivation { # TODO(tazjin): Some of these might only be required for native inputs buildInputs = with pkgs; [ + abseil_cpp aws-s3-cpp brotli bzip2 -- cgit 1.4.1