llvmPackages/libc++: Fix build against glibc 2.26
This is very similar to what we had in bb0b0822ef39d987952a04ae61fb8071.
The xlocale.h header is no longer existing in glibc version 2.26, so we
need to avoid including it.
I've tested building against all of the libcxx attributes of LLVM 3.5,
3.7, 3.8, 3.9, 4 and 5.
All of them succeeded except version 3.5, which failed because of an
unrelated issue (build of libc++abi has failed, one of its
dependencies), so I only verified whether the patch applies cleanly.
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @vcunat
commit44cb95a23460707cb100720c23aae6e497177268
authoraszlig <aszlig@nix.build>
dateWed 8 Nov 2017, 22:01 (9 years ago)
parent03e8bed
pkgs/development/compilers/llvm/3.5/libc++/default.nix+5−1
@@ -20,7 +20,11 @@ stdenv.mkDerivation rec {
2020 '"${libcxxabi}/lib/libc++abi.dylib"'
2121 '';
2222
23− patches = [ ./darwin.patch ];
23+ patches = [
24+ ./darwin.patch
25+ # glibc 2.26 fix
26+ ./xlocale-glibc-2.26.patch
27+ ];
2428
2529 buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
2630
pkgs/development/compilers/llvm/3.5/libc++/xlocale-glibc-2.26.patchnew file+17
@@ -0,0 +1,17 @@
1+diff --git a/include/__locale b/include/__locale
2+index 3daa1f1..cb8e151 100644
3+--- a/include/__locale
4++++ b/include/__locale
5+@@ -29,10 +29,10 @@
6+ # if __ANDROID_API__ <= 20
7+ # include <support/android/locale_bionic.h>
8+ # endif
9+-#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
10++#elif (defined(__APPLE__) || defined(__FreeBSD__) \
11+ || defined(__sun__) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
12+ # include <xlocale.h>
13+-#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
14++#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
15+
16+ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17+ #pragma GCC system_header
pkgs/development/compilers/llvm/3.7/libc++/default.nix+2
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
1717 patches = [
1818 ./darwin.patch
1919 ./r242056.patch
20+ # glibc 2.26 fix
21+ ./xlocale-glibc-2.26.patch
2022 ];
2123
2224 buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
pkgs/development/compilers/llvm/3.7/libc++/xlocale-glibc-2.26.patchnew file+17
@@ -0,0 +1,17 @@
1+diff --git a/include/__locale b/include/__locale
2+index 1989558..1e42905 100644
3+--- a/include/__locale
4++++ b/include/__locale
5+@@ -34,10 +34,10 @@
6+ # include <support/solaris/xlocale.h>
7+ #elif defined(_NEWLIB_VERSION)
8+ # include <support/newlib/xlocale.h>
9+-#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
10++#elif (defined(__APPLE__) || defined(__FreeBSD__) \
11+ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
12+ # include <xlocale.h>
13+-#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
14++#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
15+
16+ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17+ #pragma GCC system_header
pkgs/development/compilers/llvm/3.8/libc++/default.nix+4−1
@@ -14,7 +14,10 @@ stdenv.mkDerivation rec {
1414 cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include")
1515 '';
1616
17− patches = lib.optional stdenv.isDarwin ./darwin.patch;
17+ patches = [
18+ # glibc 2.26 fix
19+ ../../3.9/libc++/xlocale-glibc-2.26.patch
20+ ] ++ lib.optional stdenv.isDarwin ./darwin.patch;
1821
1922 buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
2023
pkgs/development/compilers/llvm/3.9/libc++/default.nix+4−1
@@ -14,7 +14,10 @@ stdenv.mkDerivation rec {
1414 cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$NIX_BUILD_TOP/libcxxabi-${version}.src/include")
1515 '';
1616
17− patches = lib.optional stdenv.isDarwin ./darwin.patch;
17+ patches = [
18+ # glibc 2.26 fix
19+ ./xlocale-glibc-2.26.patch
20+ ] ++ lib.optional stdenv.isDarwin ./darwin.patch;
1821
1922 buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
2023
pkgs/development/compilers/llvm/3.9/libc++/xlocale-glibc-2.26.patchnew file+19
@@ -0,0 +1,19 @@
1+diff --git a/include/__locale b/include/__locale
2+index 7bc701d..ea75c86 100644
3+--- a/include/__locale
4++++ b/include/__locale
5+@@ -34,12 +34,12 @@
6+ # include <support/solaris/xlocale.h>
7+ #elif defined(_NEWLIB_VERSION)
8+ # include <support/newlib/xlocale.h>
9+-#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
10++#elif (defined(__APPLE__) || defined(__FreeBSD__) \
11+ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
12+ # include <xlocale.h>
13+ #elif defined(_LIBCPP_HAS_MUSL_LIBC)
14+ # include <support/musl/xlocale.h>
15+-#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
16++#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
17+
18+ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19+ #pragma GCC system_header
pkgs/development/compilers/llvm/4/libc++/default.nix+6−2
@@ -10,8 +10,12 @@ stdenv.mkDerivation rec {
1010 export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
1111 '';
1212
13− # https://github.com/llvm-mirror/libcxx/commit/bcc92d75df0274b9593ebd097fcae60494e3bffc
14− patches = [ ./pthread_mach_thread_np.patch ];
13+ patches = [
14+ # https://github.com/llvm-mirror/libcxx/commit/bcc92d75df0274b9593ebd097fcae60494e3bffc
15+ ./pthread_mach_thread_np.patch
16+ # glibc 2.26 fix
17+ ./xlocale-glibc-2.26.patch
18+ ];
1519
1620 prePatch = ''
1721 substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patchnew file+19
@@ -0,0 +1,19 @@
1+diff --git a/include/__locale b/include/__locale
2+index f4882de..29443b4 100644
3+--- a/include/__locale
4++++ b/include/__locale
5+@@ -34,12 +34,12 @@
6+ # include <support/solaris/xlocale.h>
7+ #elif defined(_NEWLIB_VERSION)
8+ # include <support/newlib/xlocale.h>
9+-#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
10++#elif (defined(__APPLE__) || defined(__FreeBSD__) \
11+ || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
12+ # include <xlocale.h>
13+ #elif defined(_LIBCPP_HAS_MUSL_LIBC)
14+ # include <support/musl/xlocale.h>
15+-#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
16++#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
17+
18+ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19+ #pragma GCC system_header