Skip to content

Commit

Permalink
fix a llvm compilation error with llvm16
Browse files Browse the repository at this point in the history
LLVM16 patch
  llvm/llvm-project@b4e9977
caused bcc build failure like below:

 from /.../bcc/src/cc/frontends/clang/b_frontend_action.cc:23:
 /.../llvm-project/llvm/build/install/include/llvm/ADT/StringRef.h:96:54: error: expected ‘)’ before ‘Str’
     /*implicit*/ constexpr StringRef(std::string_view Str)
                                     ~                ^~~~
                                                      )
 /.../llvm-project/llvm/build/install/include/llvm/ADT/StringRef.h:239:14: error: expected type-specifier
     operator std::string_view() const {
              ^~~

LLVM build itself now is done with c++17. Let us also compile with c++17
if bcc is built with llvm16.

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Aug 10, 2022
1 parent c65e6c5 commit 1c4e10b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ if (USINGISYSTEM AND GCC_VERSION VERSION_LESS 6.0)
endif()

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 16 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 16)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()

endif(NOT PYTHON_ONLY)

Expand Down

0 comments on commit 1c4e10b

Please sign in to comment.