doris be按照官方文档使用clion 配置,报错

Viewed 81

配置信息:
image.png
image.png

报错信息:

CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/x64/share/cmake-3.27/Modules/CMakeTestCXXCompiler.cmake:60 (message):
  The C++ compiler

    "/usr/local/opt/llvm/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/cecotw/java/doris/be/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-IruJ2x'
    
    Run Build Command(s): /Applications/CLion.app/Contents/bin/ninja/mac/x64/ninja -v cmTC_2ffd8
    [1/2] /usr/local/opt/llvm/bin/clang++   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.7 -fcolor-diagnostics -MD -MT CMakeFiles/cmTC_2ffd8.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_2ffd8.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_2ffd8.dir/testCXXCompiler.cxx.o -c /Users/cecotw/java/doris/be/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-IruJ2x/testCXXCompiler.cxx
    [2/2] : && /usr/local/opt/llvm/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.7 -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/cmTC_2ffd8.dir/testCXXCompiler.cxx.o -o cmTC_2ffd8   && :
    FAILED: cmTC_2ffd8 
    : && /usr/local/opt/llvm/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.7 -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/cmTC_2ffd8.dir/testCXXCompiler.cxx.o -o cmTC_2ffd8   && :
    ld: library not found for -lc++
    clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

image.png

1 Answers

通常发生在使用非默认编译器(如LLVM/Clang)时,可能是因为没有正确设置库的路径。

可以尝试以下几种解决方案:
1.确认是否安装了libc++库。如果没有,需要安装它。[1]提到了在编译Doris时需要的一些组件,但并未具体到libc++库。

2.如果已经安装了libc++,但是编译器找不到它,您可能需要设置或更新环境变量以包含该库的路径。例如,如果libc++位于/usr/local/opt/llvm/lib,您可以在CLion的CMake设置中或者在终端中设置以下环境变量:

export CPLUS_INCLUDE_PATH=/usr/local/opt/llvm/include/c++/v1:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=/usr/local/opt/llvm/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/opt/llvm/lib:$LD_LIBRARY_PATH

注意替换路径为实际的库文件位置。

3.在CMakeLists.txt文件中,您可能需要添加或修改find_package命令来确保CMake能够找到正确的编译器标志和库路径。

4.如果以上步骤都不起作用,您可以考虑使用系统默认的GCC编译器而不是LLVM/Clang,看看是否能解决问题。

为更具体地了解问题(处理后会更新回帖),可以➕我一下W:yz-jayhua