Skip to content

Commit

Permalink
Fix a llvm16 compilation error
Browse files Browse the repository at this point in the history
With latest llvm16, I got the following build errors:
  ...
  /.../bcc/build/src/cc/libbcc.so: undefined reference to
    `llvm::hlsl::FrontendResource::FrontendResource(llvm::GlobalVariable*,
     llvm::StringRef, llvm::hlsl::ResourceKind, unsigned int, unsigned int)'
  collect2: error: ld returned 1 exit status
  make[2]: *** [tests/cc/CMakeFiles/test_libbcc.dir/build.make:371: tests/cc/test_libbcc] Error 1
  ...

The reason is due to llvm upsteam patch https://reviews.llvm.org/D135110
which added llvm library FrontendHLSL as a dependency to clang CodeGen library.
So we need to add it as well for non-shared library build mode.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Oct 27, 2022
1 parent 54a02ce commit 8b5b0bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/clang_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ endif()
if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 15 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 15)
list(APPEND llvm_raw_libs windowsdriver)
endif()
if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 16 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 16)
list(APPEND llvm_raw_libs frontendhlsl)
endif()

llvm_map_components_to_libnames(_llvm_libs ${llvm_raw_libs})
llvm_expand_dependencies(llvm_libs ${_llvm_libs})
endif()
Expand Down

0 comments on commit 8b5b0bb

Please sign in to comment.