3

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

我几乎没有 Cmake 经验。其他人贡献了 CMake 文件,而我则为与它们相关的任务而苦苦挣扎。我不确定我是否做错了什么,我们的 Cmake 文件是否损坏,或者 Cmake 在 Solaris 下是否经过良好测试。

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


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

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

$ 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 专家(而且我不确定如何搞砸 a 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.
4

1 回答 1

2

所以出现了两个问题。首先是 Sun 提供的低级 Cmake。将其诊断为“太旧”并不是什么天才。

第二个问题更有趣。看来这CMake Error: Could not find CMAKE_ROOT !!!是由于sudo make install一旦我切换到sudo gmake install问题就消失了。

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

于 2016-09-13T15:21:33.957 回答