Open glasserc opened 5 years ago
hum … it sounds that when we are building with clang, we should use clang as much as possible for the libclang-path
and the clang-path
.
Fixing the first issue lead to another issue which made me to not investigate more in the first place, which is:
0:18.27 make[4]: *** […/src/config/rules.mk:801: Unified_cpp_xpcom_threads0.o] Error 1
0:18.27 make[4]: *** Waiting for unfinished jobs....
0:19.60 In file included from …/bld/xpcom/threads/Unified_cpp_xpcom_threads1.cpp:83:
0:19.60 In file included from …/src/xpcom/threads/nsThread.cpp:25:
0:19.61 In file included from …/bld/dist/include/mozilla/BackgroundHangMonitor.h:10:
0:19.61 In file included from …/bld/dist/include/mozilla/CPUUsageWatcher.h:12:
0:19.61 In file included from …/bld/dist/include/mozilla/HangAnnotations.h:12:
0:19.61 In file included from …/bld/ipc/ipdl/_ipdlheaders/mozilla/HangTypes.h:11:
0:19.61 In file included from …/bld/dist/include/ipc/IPCMessageUtils.h:11:
0:19.61 In file included from …/src/ipc/chromium/src/chrome/common/ipc_message_utils.h:14:
0:19.61 In file included from …/src/ipc/chromium/src/base/file_path.h:74:
0:19.61 In file included from …/src/ipc/chromium/src/base/hash_tables.h:70:
0:19.61 /nix/store/wr5dlcw1asw8dwgm4bwjmga8f52m5lfx-gcc-7.4.0/include/c++/7.4.0/ext/hash_map:60:10: fatal error: 'backward_warning.h' file not found
0:19.61 #include "backward_warning.h"
0:19.61 ^~~~~~~~~~~~~~~~~~~~
0:19.71 1 error generated.
Ah yes. I posted a comment on the PR, but I also got this. I think what's happening is that (because of the cxxLib
argument), clang
is #include
ing headers from GCC, which #include
this backward_warning.h
(which is a GCC implementation detail).
I hacked up my local version because I knew I only cared about clang7. I eventually got a successful build using this:
diff --git a/pkgs/gecko/default.nix b/pkgs/gecko/default.nix
index a9479d2..860605f 100644
--- a/pkgs/gecko/default.nix
+++ b/pkgs/gecko/default.nix
@@ -9,7 +9,7 @@
, setuptools
, rust # rust & cargo bundled. (otheriwse use pkgs.rust.{rustc,cargo})
, buildFHSUserEnv # Build a FHS environment with all Gecko dependencies.
-, llvm, llvmPackages, nasm
+, llvm, llvmPackages_7, nasm
, ccache
, zlib, xorg
@@ -110,13 +110,14 @@ let
];
genMozConfig = ''
- cxxLib=$( echo -n ${gcc}/include/c++/* )
- archLib=$cxxLib/$( ${gcc}/bin/gcc -dumpmachine )
+ cxxLib=$( echo -n ${llvmPackages_7.libcxx}/include/c++/* )
+ archLib=$cxxLib/$( ${llvmPackages_7.clang}/bin/clang -dumpmachine )
cat - > $MOZCONFIG <<EOF
mk_add_options AUTOCONF=${autoconf213}/bin/autoconf
- ac_add_options --with-libclang-path=${llvmPackages.clang.cc.lib}/lib
- ac_add_options --with-clang-path=${llvmPackages.clang}/bin/clang
+ ac_add_options --with-libclang-path=${llvmPackages_7.clang.cc.lib}/lib
+ ac_add_options --with-clang-path=${llvmPackages_7.clang}/bin/c++
+ #ac_add_options --enable-linker=${llvmPackages_7.lld}/bin/lld
export BINDGEN_CFLAGS="-cxx-isystem $cxxLib -isystem $archLib"
export CC="${stdenv.cc}/bin/cc"
export CXX="${stdenv.cc}/bin/c++"
@@ -129,9 +130,9 @@ let
export CC="${stdenv.cc}/bin/cc";
export CXX="${stdenv.cc}/bin/c++";
# To be used when building the JS Shell.
- export NIX_EXTRA_CONFIGURE_ARGS="--with-libclang-path=${llvmPackages.clang.cc.lib}/lib --with-clang-path=${llvmPackages.clang}/bin/clang"
- cxxLib=$( echo -n ${gcc}/include/c++/* )
- archLib=$cxxLib/$( ${gcc}/bin/gcc -dumpmachine )
+ export NIX_EXTRA_CONFIGURE_ARGS="--with-libclang-path=${llvmPackages_7.clang.cc.lib}/lib --with-clang-path=${llvmPackages_7.clang}/bin/clang"
+ cxxLib=$( echo -n ${llvmPackages_7.libcxx}/include/c++/* )
+ archLib=$cxxLib/$( ${llvmPackages_7.clang}/bin/clang -dumpmachine )
export BINDGEN_CFLAGS="-cxx-isystem $cxxLib -isystem $archLib"
${genMozConfig}
${builtins.getEnv "NIX_SHELL_HOOK"}
@@ -159,7 +160,7 @@ let
};
in
-stdenv.mkDerivation {
+llvmPackages_7.libcxxStdenv.mkDerivation {
name = "gecko-dev-${version}";
inherit src buildInputs shellHook;
mach build
fails with:After some investigation, it's something to do with the generated
.mozconfig.nix-shell
, which is:mach
is unhappy because the argument to--with-clang-path
doesn't correspond to the C++ compiler. I was eventually able to get it to work by hardcodingllvmPackages_7
ingecko/default.nix
, and making some changes to the other paths, but I don't have a clean fix yet (and I'm not even sure this fix is correct -- the build is still happening).