我cmake
大约两周前开始学习并喜欢它.到目前为止,我已经成功地构建和包装(与本地系统封装格式)libc++abi
,libc++
,llvm
3.4所有cmake
(libc++abi
我自己cmake
设置)为RHEL 6.x中,20 +的Fedora和Ubuntu 12.04 LTS +.
我想创建一个C++构建环境
让我们libstdc++
完全依赖GNU GCC(因此我们不希望从上述发行版或LLVM Debian/Ubuntu夜间软件包下载站点获得任何LLVM RPM/DEB )
使我们能够完全探索C++ 11和C++ 1y.换句话说,我们可以尝试,甚至我们想同时保持我们所有的编译系统干净,包管理系统最前沿LLVM /铛随时随地.
尽管如此,我试图在运行Ubuntu 12.04 LTS 64bit的构建主机上构建clang
3.4 cmake
,并使用由我构建的纯粹的 clang 3.3 而不依赖于GNU libstdc++
,以及libc++
3.3和libc++abi
.后两者也没有libstdc++
依赖.我也是这样建造的.
我非常了解Clang - Getting Started网页,并成功使用了那里的说明.但这些正是我不想使用的.他们是不正确太:对CMakeLists.txt
的clang
3.4明确规定如下:
1 # If we are not building as a part of LLVM, build Clang as an 2 # standalone project, using LLVM as an external library: 3 if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) 4 project(Clang) 5 cmake_minimum_required(VERSION 2.8) 6 7 set(CLANG_PATH_TO_LLVM_SOURCE "" CACHE PATH 8 "Path to LLVM source code. Not necessary if using an installed LLVM.") 9 set(CLANG_PATH_TO_LLVM_BUILD "" CACHE PATH 10 "Path to the directory where LLVM was built or installed.")
请参阅第1行和第2行.但是,我还没有找到任何有关如何设置的LLVM文档CLANG_PATH_TO_LLVM_BUILD
.我尝试了以下方法:
cmake -DCLANG_PATH_TO_LLVM_BUILD="../../llvm-3.4/build" ..
并得到以下错误:
$ clang3.4/_tars/clang-3.4/build$ cmake -DCLANG_PATH_TO_LLVM_BUILD="../../llvm-3.4/build" .. -- The C compiler identification is Clang 3.3.0 -- The CXX compiler identification is Clang 3.3.0 -- Check for working C compiler: /usr/bin/clang -- Check for working C compiler: /usr/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/clang++ -- Check for working CXX compiler: /usr/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Error at CMakeLists.txt:39 (include): include could not find load file: AddLLVM CMake Error at CMakeLists.txt:40 (include): include could not find load file: TableGen -- Performing Test C_SUPPORTS_FLAG -- Performing Test C_SUPPORTS_FLAG - Success -- Performing Test CXX_SUPPORTS_FLAG -- Performing Test CXX_SUPPORTS_FLAG - Success -- Building with -fPIC -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success -- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.7.8") -- Clang version: 3.4 -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Success CMake Error at utils/TableGen/CMakeLists.txt:3 (add_tablegen): Unknown CMake command "add_tablegen". -- Configuring incomplete, errors occurred!
但那不对!LLVM + compiler-rt
已经使用我们自己的构建主机安装DEB
.和,
$ llvm/clang3.4/_tars/clang-3.4/build$ ls /usr/share/llvm/cmake AddLLVM.cmake ChooseMSVCCRT.cmake linux_issue.cmake LLVMConfigVersion.cmake pkg.cmake AddLLVMDefinitions.cmake GetSVN.cmake LLVM-Config.cmake LLVMParseArguments.cmake TableGen.cmake arch.cmake HandleLLVMOptions.cmake LLVMConfig.cmake LLVMProcessSources.cmake
因此,所有必需的cmake
模块都在那里 - 就在系统上!
我很感激有关如何使用已经安装的LLVM 3.4 + 3.4 强制clang
构建3.4 的提示.cmake
compiler-rt
更新:
我决定做以下事情:
$ llvm/clang3.4/_tars/clang-3.4/build$ cmake -DCLANG_PATH_TO_LLVM_BUILD="/usr" .. -- Building with -fPIC -- Clang version: 3.4 -- Found Subversion: /usr/bin/svn (found version "1.6.17") -- Configuring done -- Generating done -- Build files have been written to: ../llvm/clang3.4/_tars/clang-3.4/build ../llvm/clang3.4/_tars/clang-3.4/build$ make -j 2 Scanning dependencies of target ClangDriverOptions Scanning dependencies of target clang-tblgen [ 0%] Building Options.inc... [ 0%] ../llvm/clang3.4/_tars/clang-3.4/include/clang/Driver/Options.td:15:9: error: Could not find include file 'llvm/Option/OptParser.td' include "llvm/Option/OptParser.td" ^ .../llvm/clang3.4/_tars/clang-3.4/include/clang/Driver/Options.td:15:9: Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangASTNodesEmitter.cpp.o error: Unexpected input at top level include "llvm/Option/OptParser.td" ^ make[2]: *** [include/clang/Driver/Options.inc.tmp] Error 1 make[1]: *** [include/clang/Driver/CMakeFiles/ClangDriverOptions.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 0%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangAttrEmitter.cpp.o [ 0%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentCommandInfoEmitter.cpp.o [ 0%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp.o [ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangCommentHTMLTagsEmitter.cpp.o [ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangDiagnosticsEmitter.cpp.o [ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/ClangSACheckersEmitter.cpp.o [ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/NeonEmitter.cpp.o [ 1%] Building CXX object utils/TableGen/CMakeFiles/clang-tblgen.dir/TableGen.cpp.o Linking CXX executable ../llvm/clang3.4/_tars/llvm-3.4/build/bin/clang-tblgen [ 1%] Built target clang-tblgen make: *** [all] Error 2
那更好.看起来clang
3.4的默认值CMakeLists.txt
甚至不是QA-ed x-(Yikes x-(