CMake does not find compiler with C++11 support - cmake

I am trying to install the FANN library for use in a project. I am using this as my guide but when I run cmake ., I receive this:
`$ cmake .
-- FANN is used as APPLICATION_NAME
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Could NOT find OpenMP (missing: OpenMP_CXX_FLAGS)
-- The compiler /usr/bin/c++ has no C++0x, C++11 or C++14 support. FANN will still work with no problem, but the tests will not be able to compile.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/marvin/fann`
even if I have gcc/g++ 4.9 installed. Looking at the instructions from Git hub, the output when running cmake . should be something like this:
`-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- FANN is used as APPLICATION_NAME
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
-- Found PythonInterp: /home/cobalt/anaconda3/bin/python (found version "3.4.3")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- The compiler /usr/bin/c++ has C++14 support.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cobalt/repos/fann`
any help?

Even though you have gcc-4.9 installed it's probably not in the standard location, or you have your environment variable CXX pointing to /usr/bin/c++ which is another compiler.
Try running cmake -D CMAKE_CXX_COMPILER /path/to/your/g++-4.9/binary" ..

Related

CGAL cmake on ubuntu 16.04 fails

I am trying to run the code of PU-GAN(https://github.com/liruihui/PU-GAN),you can get the program(evaluation code) in (https://github.com/liruihui/PU-GAN).but I am failed to camake CGAL libaray. i get following error:
(tf) li#li-System-Product-Name:/media/li/1d105677-e036-4fa4-8e37-124cb400f24d/user/shenbin/PU-GAN-master/evaluation_code$ cmake .
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /home/li/anaconda3/envs/tf/bin/x86_64-conda-linux-gnu-cc
-- Check for working C compiler: /home/li/anaconda3/envs/tf/bin/x86_64-conda-linux-gnu-cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.0")
-- Found OpenMP: TRUE (found version "4.5")
-- Using header-only CGAL
-- Targetting Unix Makefiles
-- Using /usr/bin/c++ compiler.
-- Found GMP: /home/li/anaconda3/envs/tf/lib/libgmp.so
-- Found MPFR: /home/li/anaconda3/envs/tf/lib/libmpfr.so
-- Found Boost: /usr/include (found suitable version "1.58.0", minimum required is "1.48")
-- Boost include dirs: /usr/include
-- Boost libraries:
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Using gcc version 4 or later. Adding -frounding-math
-- Build type:
-- USING CXXFLAGS = ' -fopenmp '
-- USING EXEFLAGS = '-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/li/anaconda3/envs/tf/lib -Wl,-rpath-link,/home/li/anaconda3/envs/tf/lib -L/home/li/anaconda3/envs/tf/lib '
CMake Warning at /usr/local/lib/cmake/CGAL/CGAL_enable_end_of_configuration_hook.cmake:99 (message):
=======================================================================
CGAL performance notice:
The variable CMAKE_BUILD_TYPE is set to "". For performance reasons, you
should set CMAKE_BUILD_TYPE to "Release".
Set CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE to TRUE if you want to disable
this warning.
=======================================================================
Call Stack (most recent call first):
CMakeLists.txt:9999 (CGAL_run_at_the_end_of_configuration)
-- Configuring done
-- Generating done
-- Build files have been written to: /media/li/1d105677-e036-4fa4-8e37-124cb400f24d/user/shenbin/PU-GAN-master/evaluation_code
(tf) li#li-System-Product-Name:/media/li/1d105677-e036-4fa4-8e37-124cb400f24d/user/shenbin/PU-GAN-master/evaluation_code$ make
Scanning dependencies of target evaluation
[ 50%] Building CXX object CMakeFiles/evaluation.dir/evaluation.cpp.o
/media/li/1d105677-e036-4fa4-8e37-124cb400f24d/user/shenbin/PU-GAN-master/evaluation_code/evaluation.cpp:19:50: fatal error: CGAL/Polygon_mesh_processing/measure.h: No such file or directory
compilation terminated.
CMakeFiles/evaluation.dir/build.make:62: recipe for target 'CMakeFiles/evaluation.dir/evaluation.cpp.o' failed
make[2]: *** [CMakeFiles/evaluation.dir/evaluation.cpp.o] Error 1
CMakeFiles/Makefile2:77: recipe for target 'CMakeFiles/evaluation.dir/all' failed
make[1]: *** [CMakeFiles/evaluation.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I cannot find a way to compile any of my CGAL Programyou
It's probably a mismatch between compilers or mismatch between the CGAL library and compilers - your CMake has found the cc compiler inside your anaconda3 directory:
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /home/li/anaconda3/envs/tf/bin/x86_64-conda-linux-gnu-cc
-- Check for working C compiler: /home/li/anaconda3/envs/tf/bin/x86_64-conda-linux-gnu-cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Different versions of C and CXX - that's not good. Please do not use the old compiler from the Anaconda distribution, and make sure both C and CXX compilers belong to the same (better the most recent) package.

CMake: How to add a subdirectory with the library?

I cannot force cmake to search the library in the subdirectory /usr/local/lib/db5.
To search for libraries I use the following script:
link_directories(/usr/local/lib/db5 /usr/local/lib /usr/lib)
set (LIBRARIES
c m util ssl pthread db)
foreach (LIBRARY ${LIBRARIES})
find_library ("${LIBRARY}_FOUND" ${LIBRARY})
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
if ( "${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND" )
message (STATUS "Adding library sources")
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endif ()
endforeach ()
The library is definitely present in the directory.
ogogon#:/usr/local/src/util# ls /usr/local/lib/db5
libdb_cxx-5.3.a libdb_cxx-5.3.so.0.0.0 libdb_cxx.so libdb_stl-5.3.so.0 libdb_stl.a libdb-5.3.so libdb-5.so
libdb_cxx-5.3.so libdb_cxx-5.so libdb_stl-5.3.a libdb_stl-5.3.so.0.0.0 libdb_stl.so libdb-5.3.so.0 libdb.a
libdb_cxx-5.3.so.0 libdb_cxx.a libdb_stl-5.3.so libdb_stl-5.so libdb-5.3.a libdb-5.3.so.0.0.0 libdb.so
Library search does not lead to success.
ogogon#ot:/usr/local/src/util# ./configure
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check the c is installed: /usr/lib/libc.so
-- Check the m is installed: /usr/lib/libm.so
-- Check the util is installed: /usr/lib/libutil.so
-- Check the ssl is installed: /usr/lib/libssl.so
-- Check the pthread is installed: /usr/lib/libpthread.so
-- Check the db is installed: db_FOUND-NOTFOUND
-- Adding library sources
CMake Error at CMakeLists.txt:27 (add_subdirectory):
add_subdirectory given source "../db" which is not an existing directory.
-- Configuring incomplete, errors occurred!
See also "/usr/local/src/util/CMakeFiles/CMakeOutput.log".
If I remove the library db from the list - everything goes fine.
ogogon#ot:/usr/local/src/util# ./configure
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check the c is installed: /usr/lib/libc.so
-- Check the m is installed: /usr/lib/libm.so
-- Check the util is installed: /usr/lib/libutil.so
-- Check the ssl is installed: /usr/lib/libssl.so
-- Check the pthread is installed: /usr/lib/libpthread.so
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/util
What am I doing wrong? How do I solve this problem?
Now I solved this problem like this:
set (LIBPATHS /usr/local/lib/db5 /usr/local/lib /usr/lib libs5)
set (LIBRARIES
c m util db ssl pthread)
foreach (LIBRARY ${LIBRARIES})
find_library ("${LIBRARY}_FOUND" ${LIBRARY} PATHS ${LIBPATHS})
message (STATUS "Check the ${LIBRARY} is installed: " ${${LIBRARY}_FOUND})
if ( "${${LIBRARY}_FOUND}" STREQUAL "${LIBRARY}_FOUND-NOTFOUND" )
message (STATUS "Adding library sources")
add_subdirectory (../${LIBRARY} lib/${LIBRARY})
endif ()
endforeach ()
But, if the version of the Berkley DB library changes, the paths will have to be adjusted. Is there a way to write something like /usr/local/lib/db* ?

How to use CMake

I am trying to rebuild this on my machine:
https://github.com/sfdodge/xnet
For this I needed to install xtensor and xtensor-blas. I followed the steps and successfully installed xtensor. However, I have trouble installing xtensor-blas. I create a fresh directory and run this command
cmake /home/fatima/Downloads/xtensor-blas-master
It generates the following log:
The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- xtensor-blas v0.14.0
CMake Error at CMakeLists.txt:45 (find_package):
By not providing "Findxtensor.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "xtensor", but
CMake did not find one.
Could not find a package configuration file provided by "xtensor" with any
of the following names:
xtensorConfig.cmake
xtensor-config.cmake
Add the installation prefix of "xtensor" to CMAKE_PREFIX_PATH or set
"xtensor_DIR" to a directory containing one of the above files. If
"xtensor" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
See also "/home/fatima/Downloads/Untitled Folder 3/CMakeFiles/CMakeOutput.log".
What am I doing wrong?

CMake Error: Unsupported architecture -- ppc64. On PowerPC Ubuntu

I have PowerMac G5. I install Lubuntu xenial on it. Now I try to build database Tarantool from source.
Onthe step cmake . I have the following error:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - big endian
CMake Error at cmake/arch.cmake:19 (message):
Unsupported architecture -- ppc64,
Call Stack (most recent call first):
CMakeLists.txt:46 (include)
-- Configuring incomplete, errors occurred!
See also "/home/zlon/tarantool/CMakeFiles/CMakeOutput.log".
See also "/home/zlon/tarantool/CMakeFiles/CMakeError.log".
Is it possible to fix this error or have have no chances with Linux on PowerPC?

Trying to run cmake on Chipmunk errors occuring how to fix cmake files?

SO basically i am trying to build Chipmunk physics library on linux mint, and it has a cmake file obviously, which i tried to run and it did not complete due to some error , the output was
cmake ..
CMake Error at CMakeLists.txt:3 (cmake_policy):
Policy "CMP0042" is not known to this version of CMake.
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Configuring Chipmunk2D version 7.0.1
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Configuring incomplete, errors occurred!
See also "/home/dev/Downloads/Chipmunk2D-master/build/CMakeFiles/CMakeOutput.log".
okay i found the error from the CMakeError output file
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/cc
Build flags:
Id flags:
The output was:
No such file or directory
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/cc
Build flags:
Id flags: -c
The output was:
No such file or directory
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /usr/bin/cc
Build flags:
Id flags: -Aa
The output was:
No such file or directory
Checking whether the C compiler is IAR using "" did not match "IAR .+ Compiler":
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/bin/c++
Build flags:
Id flags:
The output was:
No such file or directory
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /usr/bin/c++
Build flags:
Id flags: -c
The output was:
No such file or directory
Checking whether the CXX compiler is IAR using "" did not match "IAR .+ Compiler":
any idea how i can fix the cmake files to work?
Your CMake version is too old. CMP0042 was introduced in CMake 2.8.12.
You can try to remove the line in CMakeLists.txt:3, it should be make_policy(CMP0042). But no guarantee that the other parts will work as expected.