Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Compilation 如何使用clang 3.6.0和libc++构建cmake 3.1.3? 我试图用CLAN和它自己的C++库来构建Cuff3.1.3,即: export CC=clang export CXX=clang++ export CXXFLAGS="-std=c++11 -stdlib=libc++" export LDFLAGS="-lc++ -lc++abi"_Compilation_Cmake_Clang_Libc++ - Fatal编程技术网

Compilation 如何使用clang 3.6.0和libc++构建cmake 3.1.3? 我试图用CLAN和它自己的C++库来构建Cuff3.1.3,即: export CC=clang export CXX=clang++ export CXXFLAGS="-std=c++11 -stdlib=libc++" export LDFLAGS="-lc++ -lc++abi"

Compilation 如何使用clang 3.6.0和libc++构建cmake 3.1.3? 我试图用CLAN和它自己的C++库来构建Cuff3.1.3,即: export CC=clang export CXX=clang++ export CXXFLAGS="-std=c++11 -stdlib=libc++" export LDFLAGS="-lc++ -lc++abi",compilation,cmake,clang,libc++,Compilation,Cmake,Clang,Libc++,接 ./bootstrap 但是,由于引导脚本测试CXX编译器的方式不同,这不起作用。如果我破解引导文件并将LDFLAGS添加到CXX测试中,我就可以开始编译cmake了。然而,一旦我到达引导阶段,编译cmake二进制文件就被破坏了。我做错了什么?使用Angew的想法并尝试使用现有的cmake安装进行编译实际上会让您走得更远:如果您使用与上述几乎相同的导出: export CC=clang export CXX=clang++ export CXXFLAGS="-std=c++11 -st

./bootstrap

但是,由于引导脚本测试CXX编译器的方式不同,这不起作用。如果我破解引导文件并将LDFLAGS添加到CXX测试中,我就可以开始编译cmake了。然而,一旦我到达引导阶段,编译cmake二进制文件就被破坏了。我做错了什么?

使用Angew的想法并尝试使用现有的cmake安装进行编译实际上会让您走得更远:如果您使用与上述几乎相同的导出:

export CC=clang 
export CXX=clang++ 
export CXXFLAGS="-std=c++11 -stdlib=libc++" 
export LDFLAGS="-L${COMPILERROOT}/lib -lc++ -lc++abi"
假设您位于另一个构建目录中,并且您将cmake源代码提取到当前目录中的../cmake,则需要使用一点sed来绕过一个奇怪的编译错误

sed -i s/kwsys_ios::hex/cmsys_ios::istringstream::hex/g ../cmake/Source/kwsys/SystemInformation.cxx
sed -i s/kwsys_ios::dec/cmsys_ios::istringstream::dec/g ../cmake/Source/kwsys/SystemInformation.cxx
然后,您可以通过以下方式编译cmake:

cmake ../cmake/ -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}
make -j${NPROC}
make install
它仍然崩溃,例如,如果我尝试安装Cern ROOT6:

This warning is for project developers.  Use -Wno-dev to suppress it.
uncaught_exception not yet implemented

Program received signal SIGABRT, Aborted.
0x00007ffff6e495e9 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff6e495e9 in raise () from /lib64/libc.so.6
#1  0x00007ffff6e4acf8 in abort () from /lib64/libc.so.6
#2  0x00007ffff7b755a5 in std::uncaught_exception() () from /home/balzer/middleware/software/clang/3.6.0/lib/libc++.so.1
#3  0x00007ffff7ba80fd in std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() () from /home/balzer/middleware/software/clang/3.6.0/lib/libc++.so.1
#4  0x0000000000531561 in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) ()
#5  0x0000000000530c8c in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) ()
#6  0x000000000052fccb in cmakemainMessageCallback(char const*, char const*, bool&, void*) ()
#7  0x00000000007527c9 in cmSystemTools::Message(char const*, char const*) ()
#8  0x000000000085c934 in cmake::IssueMessage(cmake::MessageType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cmListFileBacktrace const&) ()
#9  0x000000000062a756 in cmMakefile::IssueMessage(cmake::MessageType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const ()
#10 0x00000000009c56cb in cmConditionEvaluator::GetDefinitionIfUnquoted(cmExpandedCommandArgument const&) const ()
#11 0x00000000009c57fd in cmConditionEvaluator::GetVariableOrString(cmExpandedCommandArgument const&) const ()
#12 0x00000000009c0600 in cmConditionEvaluator::HandleLevel2(std::__1::list<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#13 0x00000000009bce3b in cmConditionEvaluator::IsTrue(std::__1::vector<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#14 0x00000000009bdd5e in cmConditionEvaluator::HandleLevel0(std::__1::list<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#15 0x00000000009bcd91 in cmConditionEvaluator::IsTrue(std::__1::vector<cmExpandedCommandArgument, std::__1::allocator<cmExpandedCommandArgument> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, cmake::MessageType&) ()
#16 0x00000000009d902b in cmIfCommand::InvokeInitialPass(std::__1::vector<cmListFileArgument, std::__1::allocator<cmListFileArgument> > const&, cmExecutionStatus&) ()
#17 0x000000000062b4d6 in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#18 0x000000000098ffb1 in cmForEachFunctionBlocker::IsFunctionBlocked(cmListFileFunction const&, cmMakefile&, cmExecutionStatus&) ()
#19 0x000000000062c5cb in cmMakefile::IsFunctionBlocked(cmListFileFunction const&, cmExecutionStatus&) ()
#20 0x000000000062b21c in cmMakefile::ExecuteCommand(cmListFileFunction const&, cmExecutionStatus&) ()
#21 0x0000000000630242 in cmMakefile::ReadListFile(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool) ()
#22 0x00000000005cbad4 in cmLocalGenerator::ReadInputFile() ()
#23 0x00000000005cb437 in cmLocalGenerator::Configure() ()
#24 0x0000000000ca2af8 in cmLocalUnixMakefileGenerator3::Configure() ()
#25 0x0000000000bf3df6 in cmGlobalGenerator::Configure() ()
#26 0x0000000000c44edd in cmGlobalUnixMakefileGenerator3::Configure() ()
#27 0x000000000084c49e in cmake::ActualConfigure() ()
#28 0x0000000000849b24 in cmake::Configure() ()
#29 0x0000000000850efa in cmake::Run(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, bool) ()
#30 0x000000000052f665 in do_cmake(int, char const* const*) ()
#31 0x000000000052c149 in main ()

但是,如果我将-Wno-dev选项添加到cmake调用中,它就可以正常工作。

您是否可以选择使用不同的cmake构建而不是引导过程?我可以试试,您会推荐哪一个?几乎可以。如果没有其他选择,可以使用GCC引导一个。我的观点是,引导过程只有在您没有之前的CMake时才是必要的。如果你不能让引导程序与Clang一起工作,为什么不使用一个实际的CMake呢?所以我尝试使用现有的CMake安装,我可以做得更远一些。