0

Ubuntu 14.04 here. I am trying to install and build Eigen (C++ library) from source and am running into some Ubuntu/GCC config errors. It's definitely not a problem with the source code, so I don't think StackOverflow is the appropriate site for this question.

The commands I ran were:

hg clone https://bitbucket.org/eigen/eigen#3.2
mkdir eigen_build && cd eigen_build
cmake . ../eigen

When I run that cmake command I get the following errors:

-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is unknown
-- 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
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
-- Performing Test standard_math_library_linked_to_automatically

CMake Error at /usr/share/cmake-2.8/Modules/CMakeCXXInformation.cmake:37 (get_filename_component): get_filename_component called with incorrect number of arguments Call Stack (most recent call first): CMakeLists.txt:3 (PROJECT)

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Performing Test standard_math_library_linked_to_automatically - Failed
-- Performing Test standard_math_library_linked_to_as_m
CMake Error at /usr/share/cmake-2.8/Modules/CMakeCXXInformation.cmake:37 (get_filename_component):
    get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
    CMakeLists.txt:3 (PROJECT)

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Performing Test standard_math_library_linked_to_as_m - Failed
CMake Error at CMakeLists.txt:75 (message):
    Can't link to the standard math library.  Please report to the Eigen
    developers, telling them about your platform.

-- Configuring incomplete, errors occurred!
See also "/home/vagrant/eigen_build/CMakeFiles/CMakeOutput.log".
See also "/home/vagrant/eigen_build/CMakeFiles/CMakeError.log".

The contents of that CMakeError.log file are:

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND
Build flags:
Id flags:

The output was:
No such file or directory

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: CMAKE_CXX_COMPILER-NOTFOUND
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":
Performing C++ SOURCE FILE Test standard_math_library_linked_to_automatically failed with the following output:

Source file was:
#include<cmath>
int main() { std::sin(0.0); std::log(0.0f); }
Performing C++ SOURCE FILE Test standard_math_library_linked_to_as_m failed with the following output:

Source file was:
#include<cmath>
int main() { std::sin(0.0); std::log(0.0f); }

Can anyone help me decipher whether this is a GCC config issue, or something wrong with Eigen's make (I highly doubt it)?

GCC is installed (running gcc -v yields gcc version 4.8.4). I also know cmake is installed (by running cmake --help). Just not sure if it's configured correctly. Any ideas?

  • 1
    You have gcc - but do you have g++? Try sudo apt-get install g++ (or install it via your favorite package manager) – steeldriver Oct 7 '16 at 0:04
  • Thanks @steeldriver (+1) - I tried that and then re-ran the cmake command, but am still getting the same errors. – smeeb Oct 7 '16 at 0:17
  • So what does g++ --version say? or if that fails, type g++? – steeldriver Oct 7 '16 at 0:19
  • When I run g++ --version I get g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 followed by a copyright notice. – smeeb Oct 7 '16 at 0:19
  • Hmm... in that case I don't know why cmake wouldn't find it - as a workaround you could try defining it explicitly on the command line e.g. cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++ . ../eigen – steeldriver Oct 7 '16 at 0:30

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.