meelgroup / approxmc

Approximate Model Counter
Other
70 stars 26 forks source link

CMake compile error in Ubuntu 16.04 - broken C Compiler #22

Closed ashwath129 closed 3 years ago

ashwath129 commented 3 years ago

OS: Ubuntu 16.04 GCC Version - 7.5 G++ Version - 7.5 CMake version - 3.5.1

When trying to compile approxmc 4.0.0 and as I run the commands,

git clone https://github.com/msoos/cryptominisat
cd cryptominisat
mkdir build && cd build
cmake ..

When i execute the cmake command I get the following error,

-- The CXX compiler identification is GNU 7.5.0
-- 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
-- LIB directory is ''
-- BIN directory is ''
-- You can choose the type of build, options are:Debug;Release;RelWithDebInfo;MinSizeRel
-- Doing a RelWithDebInfo build
-- The C compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/cc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp

  Run Build Command:"/usr/bin/make" "cmTC_c68dd/fast"

  /usr/bin/make -f CMakeFiles/cmTC_c68dd.dir/build.make
  CMakeFiles/cmTC_c68dd.dir/build

  make[1]: Entering directory
  '/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp'

  Building C object CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o

  /usr/bin/cc -o CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o -c
  /home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp/testCCompiler.c

  /home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp/testCCompiler.c:2:3:
  error: #error "The CMAKE_C_COMPILER is set to a C++ compiler"

   # error "The CMAKE_C_COMPILER is set to a C++ compiler"
     ^~~~~

  CMakeFiles/cmTC_c68dd.dir/build.make:65: recipe for target
  'CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o' failed

  make[1]: *** [CMakeFiles/cmTC_c68dd.dir/testCCompiler.c.o] Error 1

  make[1]: Leaving directory
  '/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeTmp'

  Makefile:126: recipe for target 'cmTC_c68dd/fast' failed

  make: *** [cmTC_c68dd/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:91 (PROJECT)

-- Configuring incomplete, errors occurred!
See also "/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeOutput.log".
See also "/home/ashwathv/cryptominisat/build/CMakeFiles/CMakeError.log".

I have tried to build it directly by using -DCMAKE_C_COMPILER=gcc along with the cmake command. The 'build-essentials' package is also the latest. It does however work with Ubuntu version 18.04 and Cmake version v3.10.2.

Was wondering whether there is a specification for running/compiling the source (whether you need a specific version of OS/Cmake/Any prerequisite). Or is it targeting a specific piece of code in the source, that needs to be changed ? Thanks!

msoos commented 3 years ago

Hi,

Unfortunately, this has nothing to do with ApproxMC. The cmake setup stops because your compiler is broken -- this is a basic check by cmake, I literally cannot even disable it. Either your cmake, gcc, or other essential setup of your system is broken. I suggest re-building your system, since it's Ubuntu 16.04, which is quite old. New long-term-support LTS version is 20.04. That's a good upgrade.

Sorry I cannot help, but this has nothing to do with ApproxMC, CryptoMiniSat, or indeed anything I have control over. Please check some forums or upgrade to 20.04 LTS.

Good luck,

Mate