From 990925d806989f1dbd3f703ac02f8c442492c42c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com> Date: Thu, 27 Jun 2019 12:19:11 +0200 Subject: [PATCH] Only add include directories for LLVM, clang & rapidjson if
Hello community, here is the log from the commit of package ccls for openSUSE:Factory checked in at 2019-07-02 10:38:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ccls (Old) and /work/SRC/openSUSE:Factory/.ccls.new.4615 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ccls" Tue Jul 2 10:38:28 2019 rev:3 rq:712746 version:0.20190314 Changes: -------- --- /work/SRC/openSUSE:Factory/ccls/ccls.changes 2019-06-21 09:58:42.392690775 +0200 +++ /work/SRC/openSUSE:Factory/.ccls.new.4615/ccls.changes 2019-07-02 10:38:29.370590366 +0200 @@ -1,0 +2,8 @@ +Mon Jul 1 08:21:11 UTC 2019 - Dan Čermák <dcermak@suse.com> + +- Drop 0001-Don-t-add-include-paths-as-SYSTEM.patch + Add 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch + This fixes compilation issues with gcc9 in general and has been + upstreamed. + +------------------------------------------------------------------- Old: ---- 0001-Don-t-add-include-paths-as-SYSTEM.patch New: ---- 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ccls.spec ++++++ --- /var/tmp/diff_new_pack.WPN3yW/_old 2019-07-02 10:38:30.210591645 +0200 +++ /var/tmp/diff_new_pack.WPN3yW/_new 2019-07-02 10:38:30.214591651 +0200 @@ -27,9 +27,10 @@ URL: https://github.com/MaskRay/ccls Source0: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz -# PATCH-FIX-UPSTREAM 0001-Don-t-add-include-paths-as-SYSTEM.patch -# This fixes compilation failures on PowerPC, ARM & zSystem with gcc9 -Patch0: 0001-Don-t-add-include-paths-as-SYSTEM.patch +# FIXME: drop this on the next upstream release +# PATCH-FIX-UPSTREAM 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch +# This fixes compilation failures with libstdc++ from gcc9 +Patch0: 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch BuildRequires: clang-devel >= 5.0 BuildRequires: cmake >= 3.8 @@ -70,7 +71,7 @@ %build pushd . -%cmake +%cmake -DUSE_SYSTEM_RAPIDJSON=ON # ccls currently consumes ~1GB of memory during compilation per thread %limit_build -m 1500 ++++++ 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch ++++++ they are not in CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/include/c++/9 comes before /usr/include in `{clang,gcc} -v -fsyntax-only -xc++ /dev/null`. target_include_directories(ccls SYSTEM PRIVATE ${RapidJSON_INCLUDE_DIRS}) If ${RapidJSON_INCLUDE_DIRS} resolves to /usr/include, /usr/include will be shuffled before /usr/include/c++/9 and will cause `#include_next <stdlib.h>` issues (see https://github.com/MaskRay/ccls/pull/417). Check if the include directories are already in CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES. --- CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efca2ba9..baaa6a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,17 +143,25 @@ set_property(SOURCE src/utils.cc APPEND PROPERTY COMPILE_DEFINITIONS ### Includes -target_include_directories(ccls PRIVATE src) -target_include_directories(ccls SYSTEM PRIVATE - third_party ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}) - if(USE_SYSTEM_RAPIDJSON) find_package(RapidJSON QUIET) endif() if(NOT RapidJSON_FOUND) set(RapidJSON_INCLUDE_DIRS third_party/rapidjson/include) endif() -target_include_directories(ccls SYSTEM PRIVATE ${RapidJSON_INCLUDE_DIRS}) + +target_include_directories(ccls PRIVATE src) + +foreach(include_dir third_party + ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS} ${RapidJSON_INCLUDE_DIRS}) + get_filename_component(include_dir_realpath ${include_dir} REALPATH) + # Don't add as SYSTEM if they are in CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES. + # It would reorder the system search paths and cause issues with libstdc++'s + # use of #include_next. See https://github.com/MaskRay/ccls/pull/417 + if(NOT "${include_dir_realpath}" IN_LIST CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES) + target_include_directories(ccls SYSTEM PRIVATE ${include_dir}) + endif() +endforeach() ### Install -- 2.22.0