Cmake 2.8.6 fails to identify Sun Studio 12.5 compiler
I'm working on Solaris 11.3 with Sun Studio 12.5. Sun Studio 12.5 provides the 5.14 CC compiler (C++ compiler) and Cmake 2.8.6.
$ /opt/developerstudio12.5/bin/CC -V
CC: Studio 12.5 Sun C++ 5.14 SunOS_i386 2016/05/31
Attempting to configure with Sun's Cmake 2.8.6 and SunCC 5.14 results in the following. The project is Crypto++, and the reasons for the bizarre gyrations are detailed at Solaris (Command Line) on the Crypto++ wiki. The hardware supports the selected flags.
$ export CXX=/opt/developerstudio12.5/bin/CC
$ 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"
$ rm -rf cryptopp-build
$ mkdir cryptopp-build
$ cd 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!
We are kind of floundering with this issue over at Stack Overflow, so it seems best to turn it over to the Cmake experts.
I also realize Cmake 2.8.6 is old. However, building and installing Cmake 3.6.2 creates a non-working Cmake installation on this platform, so I'm also looking for Cmake 2.8.6 work-arounds to get the compiler recognized.
Note the SunCC version string changed for Sun Studio 12.5. Here are two from the previous two versions of Sun Studio:
$ /opt/solarisstudio12.3/bin/CC -V
CC: Sun C++ 5.12 SunOS_i386 2011/11/16
$ /opt/solarisstudio12.4/bin/CC -V
CC: Sun C++ 5.13 SunOS_i386 2014/10/20