3

I'm working on Solaris 11.3 with Sun Studio 12.5. When I attempt to configure with Cmake out-of-tree, Cmake finishes with configuration errors and does not produce the makefiles. In-tree may be broken, too. But our procedures say to build out-of-tree, so that;' what I do.

I have nearly no Cmake experience. Others contributed the the CMake files, and I struggle with tasks related to them. I'm not sure if I am doing something wrong, if our Cmake files are broken, or if Cmake is not well tested under Solaris.

What is going on with CMake, and how do I fix it?


Here are the links to the Cmake files. I can copy/paste them, but it just takes up a bunch of space. The files are hosted on GitHub so they should always be available.

Here is Solaris' Cmake version, prior to me installing 3.6.2:

$ cmake --version
cmake version 2.8.6

Below is from Solaris Cmake version 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!

And:

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

I built Cmake 3.6.2 from sources and installed in /usr/local to attack the CXX compiler identification is unknown issue, but it appears to be having some troubles. As I said earlier, I'm not a Cmake expert (and I'm not sure how one can mess up 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.

Clearing the cache as suggested by @AndrewHenle results in:

# 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.
jww
  • 97,681
  • 90
  • 411
  • 885
  • Which C++ compiler are you using? Seems like it didn't like the '-xarch=avx2_i' option you gave it. – Shmuel H. Sep 13 '16 at 06:50
  • Try removing '-xarch=avx2' from the end of `CXXFLAGS`. – Shmuel H. Sep 13 '16 at 06:58
  • 2
    You'll notice in the output that CMake is using `/bin/c++` as the compiler, instead of the one you specified in `CXX`. This can happen due to CMake caching. Is the result the same if you run CMake to generate into an entirely new blank directory? – Angew is no longer proud of SO Sep 13 '16 at 07:50
  • @ShmuelHazan - This test is for Sun/Oracle's C++ compiler called SunCC. We can't remove the defines or `xarch=avx2_i` because of the reasons detailed at [Solaris (Command Line)](http://cryptopp.com/wiki/Solaris_(Command_Line)). The short of it is, SunCC is *not* GCC, and 5th generation iCore processors need to use `-xarch=avx2_i`. – jww Sep 13 '16 at 09:25
  • @jww Try running `./cryptest.sh` and get your flags from there (under PLATFORM_CXXFLAGS). Anyway, as far as I can see, it isn't a problem with cmake. The compiler failed because of the its invalid arguments, cmake saw that and reported about it. – Shmuel H. Sep 13 '16 at 09:36
  • @Angew Indeed, Seems like a `cmake` configuration issue. `/bin/c++` for the C++ compiler just isn't going to work. Try running `truss -f -e -o /some/output/file cmake ...`. That will trace all the system calls made when trying to run `cmake`, along with the entire environment for each `execve` call. It will also trace all the `open` calls, which will tell you *where* that `/bin/c++` is coming from. There will be a *lot* of data produced, so finding where the problem comes from will be tedious. Add `-t` options to `truss` such as `-t\!all -texecve -topen` to trace just `execve` and `open`. – Andrew Henle Sep 13 '16 at 10:08
  • @AndrewHenle - I believe I cleared all the caches; see the edit above. The same problem exists with Cmake 3.6.2. Let me see if tracing can uncover the issue. – jww Sep 13 '16 at 10:46
  • @ShmuelHazan - yes, I am using the `PLATFORM_CXXFLAGS` reported by `cryptest.sh`. By the way, I'm the guy who cut-in the Solaris support for the library, wrote `cryptest.sh` and wrote the wiki page. I have intimate knowledge of everything except Cmake. – jww Sep 13 '16 at 10:49
  • @ShmuelHazan - Let me back up a bit... Why can't Cmake identify the compiler when it was explicitly provided the compiler with `CXX=/opt/developerstudio12.5/bin/CC`? – jww Sep 13 '16 at 10:52
  • @jww What compiler is installed and run as `/bin/c++`? I suspect it's a different compiler that doesn't accept the `arch=avx2_i` option. If CMake 2.8.6 meets your needs otherwise, you should be able to find and create new compiler specification files for the installed version of CMake, under the `Modules/Platform` directory IIRC. The Solaris files from the CMake source are pretty rudimentary, from my recollection. – Andrew Henle Sep 13 '16 at 11:09
  • @AndrewHenle - It looks like `/bin/c++ -v` returns GCC: `gcc version 4.8.2 (GCC) `. Here's the compiler I want to use: `/opt/developerstudio12.5/bin/CC`. Its version string is `CC: Studio 12.5 Sun C++ 5.14 SunOS_i386 2016/05/31`. I can't tell the user who is having trouble he can't use his compiler; and must use whatever Cmake decides. – jww Sep 13 '16 at 11:14
  • ShmuelHazan and AndrewHenle - At this point, I think I am going to start filing bugs against Cmake. I find it best to file the bug report to alert the project; and turn the problems over to the experts. I'll report back with the bug report issue numbers for future visitors. – jww Sep 13 '16 at 11:18
  • Have you tried the CMake which runs for you (2.8.6) with a totally empty binary directory (= the directory into which you generate) and `CXX` environment variable set correctly (and `CC` as well, if possible)? What compiler does that report as using? – Angew is no longer proud of SO Sep 13 '16 at 11:31
  • 1
    @jww Do you have any idea why you're getting `CMake Error: Could not find CMAKE_ROOT !!!`? That seems like the major issue for using the version you've installed. – Andrew Henle Sep 13 '16 at 11:40
  • @AndrewHenle - *"... why you're getting CMake Error..."* - No idea. I'm getting ready to file the bug report. At this point, about all I know is (1) we provide `CmakeList.txt` and `cryptopp-config.cmake`; and (2) its coming from Cmake 3.6.2 built from sources. – jww Sep 13 '16 at 12:04
  • @jww according to [this](https://github.com/Homebrew/legacy-homebrew/issues/35888), try to remove the old cmake and reboot the machine. If that's not working, try to set CMAKE_ROOT manually. Anyway, I was wrong before (about cmake doesn't have a problem). – Shmuel H. Sep 13 '16 at 12:13
  • Shmuel, Angew, Andrew - ***`CMake Error: Could not find CMAKE_ROOT !!!`*** was caused by `sudo make install`. Switching to `sudo gmake install` resolved it. – jww Sep 13 '16 at 15:24

1 Answers1

2

So there appeared to be two problems. First was the down level Sun supplied Cmake. There's nothing genius about diagnosing it as "too old".

The second issue was more interesting. It appears the CMake Error: Could not find CMAKE_ROOT !!! was cause by sudo make install Once I switched to sudo gmake install the issue went away.

Here are the bug reports on the issue:

jww
  • 97,681
  • 90
  • 411
  • 885