From 44cb95a23460707cb100720c23aae6e497177268 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 8 Nov 2017 22:01:20 +0100 Subject: 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 Cc: @vcunat --- pkgs/development/compilers/llvm/4/libc++/default.nix | 8 ++++++-- .../compilers/llvm/4/libc++/xlocale-glibc-2.26.patch | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch (limited to 'pkgs/development/compilers/llvm/4') diff --git a/pkgs/development/compilers/llvm/4/libc++/default.nix b/pkgs/development/compilers/llvm/4/libc++/default.nix index b74d2fb89dcd..db751bcffd42 100644 --- a/pkgs/development/compilers/llvm/4/libc++/default.nix +++ b/pkgs/development/compilers/llvm/4/libc++/default.nix @@ -10,8 +10,12 @@ stdenv.mkDerivation rec { export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include" ''; - # https://github.com/llvm-mirror/libcxx/commit/bcc92d75df0274b9593ebd097fcae60494e3bffc - patches = [ ./pthread_mach_thread_np.patch ]; + patches = [ + # https://github.com/llvm-mirror/libcxx/commit/bcc92d75df0274b9593ebd097fcae60494e3bffc + ./pthread_mach_thread_np.patch + # glibc 2.26 fix + ./xlocale-glibc-2.26.patch + ]; prePatch = '' substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++" diff --git a/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch b/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch new file mode 100644 index 000000000000..e411d85066b4 --- /dev/null +++ b/pkgs/development/compilers/llvm/4/libc++/xlocale-glibc-2.26.patch @@ -0,0 +1,19 @@ +diff --git a/include/__locale b/include/__locale +index f4882de..29443b4 100644 +--- a/include/__locale ++++ b/include/__locale +@@ -34,12 +34,12 @@ + # include + #elif defined(_NEWLIB_VERSION) + # include +-#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \ ++#elif (defined(__APPLE__) || defined(__FreeBSD__) \ + || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) + # include + #elif defined(_LIBCPP_HAS_MUSL_LIBC) + # include +-#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__ ++#endif // __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__ + + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) + #pragma GCC system_header -- cgit 1.4.1