From a02a4933ee540154a5acf0663954275a34bb8a82 Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Tue, 9 Aug 2022 21:36:57 -0700 Subject: [PATCH] fix llvm15 compilation error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit With llvm15, bcc failed the compilation with the following errors: [100%] Building CXX object tests/cc/CMakeFiles/test_libbcc.dir/test_shared_table.cc.o /home/yhs/work/llvm-project/llvm/build/install/lib/libclangSema.a(SemaRISCVVectorLookup.cpp.o): In function `(anonymous namespace)::RISCVIntrinsicManagerImpl::InitIntrinsicList()': SemaRISCVVectorLookup.cpp: (.text._ZN12_GLOBAL__N_125RISCVIntrinsicManagerImpl17InitIntrinsicListEv+0x14b): undefined reference to `clang::RISCV::RVVIntrinsic::computeBuiltinTypes( llvm::ArrayRef, bool, bool, bool, unsigned int)' SemaRISCVVectorLookup.cpp:(.text._ZN12_GLOBAL__N_125RISCVIntrinsicManagerImpl17InitIntrinsicListEv+0x182): undefined reference to `clang::RISCV::RVVIntrinsic::computeBuiltinTypes( llvm::ArrayRef, bool, bool, bool, unsigned int)' ... make[1]: *** [CMakeFiles/Makefile2:1110: examples/cpp/CMakeFiles/CGroupTest.dir/all] Error 2 ... The failure is due to llvm upstream patch https://reviews.llvm.org/D111617 which introduced another dependency on libclangSupport.a for bcc. To fix the issue, I added libclangSupport in cmake file. Change-Id: Ib22adc6ed4cea639a42660ce362e22b32bdd4b85 Origin: upstream, https://github.com/iovisor/bcc/commit/c65e6c5ec5b629ef302259731df33b41b0d705ca Signed-off-by: Yonghong Song Signed-off-by: Łukasz Stelmach --- CMakeLists.txt | 3 +++ cmake/clang_libs.cmake | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d7dabe5..8d5fd9e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,9 @@ find_library(libclangRewrite NAMES clangRewrite clang-cpp HINTS ${CLANG_SEARCH}) find_library(libclangSema NAMES clangSema clang-cpp HINTS ${CLANG_SEARCH}) find_library(libclangSerialization NAMES clangSerialization clang-cpp HINTS ${CLANG_SEARCH}) find_library(libclangASTMatchers NAMES clangASTMatchers clang-cpp HINTS ${CLANG_SEARCH}) +if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 15 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 15) + find_library(libclangSupport NAMES clangSupport clang-cpp HINTS ${CLANG_SEARCH}) +endif() find_library(libclang-shared libclang-cpp.so HINTS ${CLANG_SEARCH}) if(libclangBasic STREQUAL "libclangBasic-NOTFOUND") message(FATAL_ERROR "Unable to find clang libraries") diff --git a/cmake/clang_libs.cmake b/cmake/clang_libs.cmake index f1b1261b..f855c6f8 100644 --- a/cmake/clang_libs.cmake +++ b/cmake/clang_libs.cmake @@ -50,7 +50,13 @@ list(APPEND clang_libs ${libclangRewrite} ${libclangEdit} ${libclangAST} - ${libclangLex} + ${libclangLex}) + +# if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 15 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 15) + list(APPEND clang_libs ${libclangSupport}) +# endif() + +list(APPEND clang_libs ${libclangBasic}) endif() -- 2.34.1