首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CMake无法使用SunStudio12.5生成Makefile

CMake无法使用SunStudio12.5生成Makefile
EN

Stack Overflow用户
提问于 2016-09-13 06:44:45
回答 1查看 410关注 0票数 3

我正在使用Sun Studio 12.5开发Solaris 11.3。当我尝试使用Cmake -out-tree进行配置时,Cmake会以配置错误完成,而不会生成makefile。树内也可能会被打破。但是我们的程序说要建一棵树,这样我就能做什么。

我几乎没有Cmake的经验。其他人贡献了CMake文件,我很难处理与它们相关的任务。我不确定我是否做错了什么,我们的Cmake文件是否被破坏了,或者Cmake是否在Solaris下没有很好的测试。

CMake是怎么回事,我该如何解决呢?

以下是Cmake文件的链接。我可以复制/粘贴它们,但它只占了一堆空间。这些文件托管在GitHub上,因此它们应该总是可用的。

  • CMakefileList.txt
  • cryptopp-config.cmake

以下是Solaris的Cmake版本,在我安装3.6.2之前:

代码语言:javascript
复制
$ cmake --version
cmake version 2.8.6

下面来自Solaris Cmake版本2.8.6。

代码语言:javascript
复制
cryptopp-build$ export CXX=/opt/developerstudio12.5/bin/CC
cryptopp-build$ export CXXFLAGS="-DNDEBUG -g2 -O2 -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__AES__ -D__PCLMUL__ -D__RDRND__ -D__RDSEED__ -D__AVX__ -D__AVX2__ -D__BMI__ -D__BMI2__ -D__ADX__ -xarch=avx2_i"

cryptopp-build$ cmake ../cryptopp
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:45 (MESSAGE):
  The C++ compiler "/bin/c++" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /export/home/test/cryptopp-build/CMakeFiles/CMakeTmp  

  Run Build Command:/bin/gmake "cmTryCompileExec/fast"

  /bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
  CMakeFiles/cmTryCompileExec.dir/build

  gmake[1]: Entering directory
  `/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp'

  /usr/bin/cmake -E cmake_progress_report
  /export/home/test/cryptopp-build/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building CXX object CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o

  /bin/c++ -DNDEBUG -g2 -O2 -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__
  -D__SSE4_2__ -D__AES__ -D__PCLMUL__ -D__RDRND__ -D__RDSEED__ -D__AVX__
  -D__AVX2__ -D__BMI__ -D__BMI2__ -D__ADX__ -xarch=avx2_i -o
  CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o -c
  /export/home/test/cryptopp-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx

  c++: error: language arch=avx2_i not recognized

  c++: error: language arch=avx2_i not recognized

  gmake[1]: Leaving directory
  `/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp'

  gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o] Error
  1

  gmake: *** [cmTryCompileExec/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:9 (project)

-- Configuring incomplete, errors occurred!

和:

代码语言:javascript
复制
$ /opt/developerstudio12.5/bin/CC -V
CC: Studio 12.5 Sun C++ 5.14 SunOS_i386 2016/05/31

我从源代码中构建了Cmake3.6.2,并安装在/usr/local中以解决CXX compiler identification is unknown问题,但它似乎有一些问题。正如我前面所说的,我不是一个Cmake专家(我也不知道如何才能搞砸一个make && sudo make install)。

代码语言:javascript
复制
cryptopp-build$ cmake ../cryptopp
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.

按照@AndrewHenle的建议清除缓存,结果是:

代码语言:javascript
复制
# The project GNUmakefile clears all Cmake artifacts because Cmake cannot seem to do it on its own
$ cd cryptopp
$ git status -s
$

$ cd ..
$ rm -rf cryptopp-build
$ mkdir cryptopp-build
$ cd cryptopp-build

# Using 3.6.2 now
$ cmake ../cryptopp
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
EN

回答 1

Stack Overflow用户

发布于 2016-09-13 15:21:33

所以出现了两个问题。首先是向下的Sun提供的Cmake。把它诊断为“太老”一点也不天才。

第二个问题更有趣。看来CMake Error: Could not find CMAKE_ROOT !!!是由sudo make install引起的,当我切换到sudo gmake install时,问题就消失了。

以下是有关此问题的bug报告:

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39463746

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档