CMake无法使用Sun Studio 12.5生成Makefile

时间:2016-09-13 06:44:45

标签: command-line cmake solaris sunstudio

我正在使用Sun Studio 12.5开发Solaris 11.3。当我尝试使用Cmake out-of-tree进行配置时,Cmake会完成配置错误并且不会生成makefile。树内也可能被打破。但是我们的程序说建造树外,所以;'我做了什么。

我几乎没有Cmake经验。其他人贡献了CMake文件,我努力完成与它们相关的任务。如果我们的Cmake文件坏了,或者Cmake在Solaris下没有经过良好测试,我不确定我是否做错了什么。

CMake发生了什么,我该如何解决?

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

在安装3.6.2之前,这是Solaris的Cmake版本:

$ cmake --version
cmake version 2.8.6

以下是Solaris Cmake版本2.8.6。

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!

$ /opt/developerstudio12.5/bin/CC -V
CC: Studio 12.5 Sun C++ 5.14 SunOS_i386 2016/05/31

我从源代码构建了Cmake 3.6.2并安装在/usr/local中以攻击 CXX compiler identification is unknown 问题,但它似乎遇到了一些麻烦。正如我之前所说,我不是Cmake专家(我不确定如何弄乱make && sudo make install)。

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的建议清除缓存会导致:

# 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.

1 个答案:

答案 0 :(得分:2)

所以似乎有两个问题。首先是Sun提供的Cmake。将它诊断为“太旧”并没有什么天才。

第二个问题更有趣。 CMake Error: Could not find CMAKE_ROOT !!! 似乎是由sudo make install引起的。一旦我切换到sudo gmake install,问题就会消失。

以下是有关该问题的错误报告:

相关问题