0

I am running into this problem more often:

[idf@localhost EasyCL]$ mkdir build
[idf@localhost EasyCL]$ cd build/
[idf@localhost build]$ cmake ..
-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 7.2.1
-- Check for working C compiler: /usr/bin/g++
-- Check for working C compiler: /usr/bin/g++ -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "/usr/bin/g++" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /home/idf/Documents/opencl/EasyCL/build/CMakeFiles/CMakeTmp
...

As you can see, I am using the GNU 7.2.1 compilers. In particular:

[idf@localhost build]$ sudo dnf install gcc-c++
[sudo] password for idf: 
Last metadata expiration check: 0:40:54 ago on Tue 17 Oct 2017 06:52:54 PM EDT.
Package gcc-c++-7.2.1-2.fc26.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
[idf@localhost build]$ 

I am not sure if that I am running 7.2.x is the problem. Is there a work around that will allow cmake to understand that a C compiler is installed?

EDIT

When I try to force the compiler settings, I get these errors:

CMake Deprecation Warning at /usr/share/cmake/Modules/CMakeForceCompiler.cmake:69 (message):
  The CMAKE_FORCE_C_COMPILER macro is deprecated.  Instead just set
  CMAKE_C_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
  CMakeLists.txt:4 (CMAKE_FORCE_C_COMPILER)


CMake Deprecation Warning at /usr/share/cmake/Modules/CMakeForceCompiler.cmake:83 (message):
  The CMAKE_FORCE_CXX_COMPILER macro is deprecated.  Instead just set
  CMAKE_CXX_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
  CMakeLists.txt:5 (CMAKE_FORCE_CXX_COMPILER)


-- Found PythonInterp: /usr/bin/python (found version "2.7.13") 

[hunter ** FATAL ERROR **] ABI not detected for C compiler
[hunter ** FATAL ERROR **] [Directory:/home/idf/Documents/opencl/ethminer]

------------------------------ WIKI -------------------------------
    https://github.com/ruslo/hunter/wiki/error.abi.detection.failure
-------------------------------------------------------------------
Ivan
  • 7,448
  • 14
  • 69
  • 134

1 Answers1

0

You can force it, but it's probably better to understand why it can't compile the test program. You may be in the same boat even after forcing the compiler. If you do what to force it, set these in your CMakeLists.txt:

INCLUDE(CMakeForceCompiler) 
CMAKE_FORCE_C_COMPILER(gcc GNU)
CMAKE_FORCE_CXX_COMPILER(g++ GNU)

set(CMAKE_C_COMPILER_WORKS ON)
set(CMAKE_CXX_COMPILER_WORKS ON)
Cinder Biscuits
  • 4,880
  • 31
  • 51