fix(3p): resolve linker issues with clang-compiled C++ packages
The point where this broke is likely when llvmPackages_11.stdenv started respecting stdenv.hostPlatform.linker and thus using GNU binutils' ld.bfd for linking. That linker can't deal with clang's C++ ABI. To fix this we introduce a modified version of llvmPackages_11.stdenv which uses llvmPackages_11.bintools for linking purposes (I also aim to upstream this in some form, but am not sure about the details atm, so we'll just do this in the tvl overlay for now). This is the precondition for getting our C++ packages in //third_party to work again. Additionally the following fixes were necessary: * abseil-cpp needed to be updated (by overriding the version from nixpkgs for now, since I can't update the subtree on my own) to fulfill grpc's requirements (grpc 1.41.0 needs abseil-cpp LTS 20210324). * gtest needs a patch from nixpkgs which fixes the path to its include directory for CMake. * We need to build re2 with clang as well, otherwise linking will fail. Fixes b/132. Change-Id: I7b64579fe96451547babe070fd35db398581e49d Reviewed-on: https://cl.tvl.fyi/c/depot/+/3701 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
ac17de3cbd
commit
04f7cc3880
9 changed files with 31 additions and 19 deletions
11
third_party/abseil_cpp/default.nix
vendored
11
third_party/abseil_cpp/default.nix
vendored
|
@ -1,7 +1,13 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
let inherit (pkgs) cmake llvmPackages_11;
|
||||
in llvmPackages_11.libcxxStdenv.mkDerivation rec {
|
||||
let inherit (pkgs) cmake fullLlvm11Stdenv;
|
||||
in pkgs.abseil-cpp.override {
|
||||
stdenv = fullLlvm11Stdenv;
|
||||
}
|
||||
|
||||
/* TODO(tazjin): update abseil subtree
|
||||
|
||||
fullLlvm11Stdenv.mkDerivation rec {
|
||||
pname = "abseil-cpp";
|
||||
version = "20200519-768eb2ca+tvl-1";
|
||||
src = ./.;
|
||||
|
@ -21,3 +27,4 @@ in llvmPackages_11.libcxxStdenv.mkDerivation rec {
|
|||
maintainers = [ maintainers.andersk ];
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
|
4
third_party/glog/default.nix
vendored
4
third_party/glog/default.nix
vendored
|
@ -1,7 +1,7 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
let inherit (pkgs) llvmPackages_11 cmake;
|
||||
in llvmPackages_11.libcxxStdenv.mkDerivation {
|
||||
let inherit (pkgs) fullLlvm11Stdenv cmake;
|
||||
in fullLlvm11Stdenv.mkDerivation {
|
||||
name = "glog";
|
||||
version = "20200527-unstable";
|
||||
src = ./.;
|
||||
|
|
9
third_party/grpc/default.nix
vendored
9
third_party/grpc/default.nix
vendored
|
@ -2,14 +2,11 @@
|
|||
|
||||
(pkgs.grpc.override {
|
||||
protobuf = depot.third_party.protobuf;
|
||||
stdenv = pkgs.llvmPackages_11.libcxxStdenv;
|
||||
stdenv = pkgs.fullLlvm11Stdenv;
|
||||
abseil-cpp = depot.third_party.abseil_cpp;
|
||||
re2 = depot.third_party.re2;
|
||||
}).overrideAttrs(orig: rec {
|
||||
cmakeFlags = orig.cmakeFlags ++ [
|
||||
"-DCMAKE_CXX_STANDARD=17"
|
||||
"-DCMAKE_CXX_STANDARD_REQUIRED=ON"
|
||||
];
|
||||
}) // {
|
||||
# TODO(b/132): Reenable when linker errors are fixed.
|
||||
meta.ci = false;
|
||||
}
|
||||
})
|
||||
|
|
3
third_party/gtest/default.nix
vendored
3
third_party/gtest/default.nix
vendored
|
@ -1,7 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
(pkgs.gtest.override {
|
||||
stdenv = pkgs.llvmPackages_11.libcxxStdenv;
|
||||
stdenv = pkgs.fullLlvm11Stdenv;
|
||||
}).overrideAttrs(_: {
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "google";
|
||||
|
@ -9,5 +9,4 @@
|
|||
rev = "9dce5e5d878176dc0054ef381f5c6e705f43ef99";
|
||||
sha256 = "05xi61j7j251dzkgk9965lqpbacsy44iblzql941kw9d4nk0q6jl";
|
||||
};
|
||||
patches = [];
|
||||
})
|
||||
|
|
5
third_party/nix/default.nix
vendored
5
third_party/nix/default.nix
vendored
|
@ -57,7 +57,7 @@ let
|
|||
cp ${pkgs.busybox}/bin/busybox $out/bin
|
||||
'';
|
||||
|
||||
in lib.fix (self: pkgs.llvmPackages_11.libcxxStdenv.mkDerivation {
|
||||
in lib.fix (self: pkgs.fullLlvm11Stdenv.mkDerivation {
|
||||
pname = "tvix";
|
||||
version = "2.3.4";
|
||||
inherit src;
|
||||
|
@ -187,9 +187,6 @@ in lib.fix (self: pkgs.llvmPackages_11.libcxxStdenv.mkDerivation {
|
|||
# TODO(tazjin): integration test setup?
|
||||
# TODO(tazjin): docs generation?
|
||||
|
||||
# TODO(b/132): Reenable when linker errors are fixed.
|
||||
meta.ci = false;
|
||||
|
||||
passthru = {
|
||||
build-shell = self.overrideAttrs (up: rec {
|
||||
run_clang_tidy = pkgs.writeShellScriptBin "run-clang-tidy" ''
|
||||
|
|
7
third_party/overlays/tvl.nix
vendored
7
third_party/overlays/tvl.nix
vendored
|
@ -22,6 +22,13 @@ self: super: {
|
|||
llvmPackages = self.llvmPackages_11;
|
||||
};
|
||||
|
||||
# stdenv which uses clang, lld and libc++; full is a slight exaggeration,
|
||||
# we for example don't use LLVM's libunwind
|
||||
fullLlvm11Stdenv = self.overrideCC self.stdenv
|
||||
(self.llvmPackages_11.libcxxStdenv.cc.override {
|
||||
inherit (self.llvmPackages_11) bintools;
|
||||
});
|
||||
|
||||
# Add our Emacs packages to the fixpoint
|
||||
emacsPackagesFor = emacs: (
|
||||
(super.emacsPackagesFor emacs).overrideScope' (eself: esuper: {
|
||||
|
|
4
third_party/protobuf/default.nix
vendored
4
third_party/protobuf/default.nix
vendored
|
@ -4,9 +4,9 @@
|
|||
pkgs.callPackage "${pkgs.path}/pkgs/development/libraries/protobuf/generic-v3.nix" {
|
||||
version = "3.12.2";
|
||||
sha256 = "1lp368aa206vpic9fmax4k6llnmf28plfvkkm4vqhgphmjqykvl2";
|
||||
stdenv = pkgs.llvmPackages_11.libcxxStdenv;
|
||||
stdenv = pkgs.fullLlvm11Stdenv;
|
||||
buildPackages = {
|
||||
inherit (pkgs) which;
|
||||
stdenv = pkgs.llvmPackages_11.libcxxStdenv;
|
||||
stdenv = pkgs.fullLlvm11Stdenv;
|
||||
};
|
||||
}
|
||||
|
|
2
third_party/rapidcheck/default.nix
vendored
2
third_party/rapidcheck/default.nix
vendored
|
@ -1,7 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
(pkgs.callPackage "${pkgs.path}/pkgs/development/libraries/rapidcheck" {
|
||||
stdenv = pkgs.llvmPackages_11.libcxxStdenv;
|
||||
stdenv = pkgs.fullLlvm11Stdenv;
|
||||
}).overrideAttrs (attrs: rec {
|
||||
# follows the versioning scheme of nixpkgs, since rapidcheck does not
|
||||
# provide versioned releases
|
||||
|
|
5
third_party/re2/default.nix
vendored
Normal file
5
third_party/re2/default.nix
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.re2.override {
|
||||
stdenv = pkgs.fullLlvm11Stdenv;
|
||||
}
|
Loading…
Reference in a new issue