首页 > 系统相关 >build bcc failure with clang 10 on Ubuntu 20.04

build bcc failure with clang 10 on Ubuntu 20.04

时间:2022-09-28 16:36:55浏览次数:69  
标签:10 cmake make dev bcc clang libs build

在ubuntu20.04的环境下,编译bcc项目,会存在undefined reference to `getPollyPluginInfo()'的报错,

/usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a(BackendUtil.cpp.o): in function `(anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >)':
(.text._ZN12_GLOBAL__N_118EmitAssemblyHelper30EmitAssemblyWithNewPassManagerEN5clang13BackendActionESt10unique_ptrIN4llvm17raw_pwrite_streamESt14default_deleteIS5_EE+0x1f15): undefined reference to `getPollyPluginInfo()'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/cpp/CMakeFiles/HelloWorld.dir/build.make:158: examples/cpp/HelloWorld] Error 1
make[1]: *** [CMakeFiles/Makefile2:1069: examples/cpp/CMakeFiles/HelloWorld.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

主要原因可能clang的版本问题,要么升级clang,要么采用规避方案:
方案一:采用zrait的规避方案,修改如下:

ubuntu@ubuntu:~/work/bcc/build$ git diff
diff --git a/cmake/clang_libs.cmake b/cmake/clang_libs.cmake
index f855c6f8..28ad2c2f 100644
--- a/cmake/clang_libs.cmake
+++ b/cmake/clang_libs.cmake
@@ -50,7 +50,9 @@ list(APPEND clang_libs
   ${libclangRewrite}
   ${libclangEdit}
   ${libclangAST}
-  ${libclangLex})
+  ${libclangLex}
+  Polly
+  PollyISL)

方案二:升级clang版本,参与INSTALL文件推荐的版本。

# For Focal (20.04.1 LTS)
sudo apt install -y bison build-essential cmake flex git libedit-dev \
  libllvm12 llvm-12-dev libclang-12-dev python zlib1g-dev libelf-dev libfl-dev python3-distutils

标签:10,cmake,make,dev,bcc,clang,libs,build
From: https://www.cnblogs.com/cnfeng/p/16738567.html

相关文章