Skip to content

Commit

Permalink
fix llvm15 compilation error
Browse files Browse the repository at this point in the history
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<clang::RISCV::PrototypeDescriptor>, bool, bool, bool, unsigned int)'
    SemaRISCVVectorLookup.cpp:(.text._ZN12_GLOBAL__N_125RISCVIntrinsicManagerImpl17InitIntrinsicListEv+0x182):
     undefined reference to `clang::RISCV::RVVIntrinsic::computeBuiltinTypes(
     llvm::ArrayRef<clang::RISCV::PrototypeDescriptor>, 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.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Aug 10, 2022
1 parent 408fb40 commit c65e6c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,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")
Expand Down
8 changes: 7 additions & 1 deletion cmake/clang_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit c65e6c5

Please sign in to comment.