Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Eigen3 with CXX_FLAGS

I'm trying to build Eigen3 using CMake as described in the installation menual:

root@60e449767588:/opt/tr/src/eigen/build_dir$ ../../cmake-3.8.1/bin/cmake  -DCMAKE_BUILD_TYPE=Release --build ..

This is the output:

-- Standard libraries to link to explicitly: none
-- Found unsuitable Qt version "" from NOTFOUND
-- Could NOT find CHOLMOD (missing:  CHOLMOD_INCLUDES CHOLMOD_LIBRARIES) 
-- Could NOT find UMFPACK (missing:  UMFPACK_INCLUDES UMFPACK_LIBRARIES) 
-- Could NOT find SUPERLU (missing:  SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK) 
-- Could NOT find PASTIX (missing:  PASTIX_INCLUDES PASTIX_LIBRARIES) 
-- Could NOT find SCOTCH (missing:  SCOTCH_INCLUDES SCOTCH_LIBRARIES) 
-- Could NOT find METIS (missing:  METIS_INCLUDES METIS_LIBRARIES) 
-- Could NOT find SPQR (missing:  SPQR_INCLUDES SPQR_LIBRARIES) 
-- Found unsuitable Qt version "" from NOTFOUND
-- Boost version: 1.64.0
-- Could NOT find GOOGLEHASH (missing:  GOOGLEHASH_INCLUDES GOOGLEHASH_COMPILE) 
-- Could NOT find ADOLC (missing:  ADOLC_INCLUDES ADOLC_LIBRARIES) 
-- Could NOT find MPFR (missing:  MPFR_INCLUDES MPFR_LIBRARIES MPFR_VERSION_OK) (Required is at least version "2.3.0")
-- Could NOT find GMP (missing:  GMP_INCLUDES GMP_LIBRARIES) 
-- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE) 
-- Could NOT find FFTW (missing:  FFTW_INCLUDES FFTW_LIBRARIES) 
-- Could NOT find OpenGL (missing:  OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR) 
-- Could NOT find GLUT (missing:  GLUT_glut_LIBRARY GLUT_INCLUDE_DIR) 
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing:  CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.0")
-- Found unsuitable Qt version "" from NOTFOUND
-- Qt4 not found, so disabling the mandelbrot and opengl demos
-- Could NOT find CHOLMOD (missing:  CHOLMOD_INCLUDES CHOLMOD_LIBRARIES) 
-- Could NOT find UMFPACK (missing:  UMFPACK_INCLUDES UMFPACK_LIBRARIES) 
-- Could NOT find SUPERLU (missing:  SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK) 
-- Could NOT find PASTIX (missing:  PASTIX_INCLUDES PASTIX_LIBRARIES) 
-- Could NOT find SCOTCH (missing:  SCOTCH_INCLUDES SCOTCH_LIBRARIES) 
-- Could NOT find METIS (missing:  METIS_INCLUDES METIS_LIBRARIES) 
-- ************************************************************
-- ***    Eigen's unit tests configuration summary          ***
-- ************************************************************
-- 
-- Build type:        Release
-- Build site:        60e449767588
-- Build string:      linux-4.4.0-78-generic-_-4.9.2-sse2-64bit
-- Enabled backends:  Boost.Multiprecision, 
-- Disabled backends: Cholmod,  UmfPack,  SuperLU,  PaStiX,  METIS,  SPQR,  Qt4 support,  GoogleHash,  Adolc,  MPFR C++,  fftw,  OpenGL, 
-- Default order:     Column-major
-- Maximal matrix/vector size: 320
-- SSE2:              Using architecture defaults
-- SSE3:              Using architecture defaults
-- SSSE3:             Using architecture defaults
-- SSE4.1:            Using architecture defaults
-- SSE4.2:            Using architecture defaults
-- AVX:               Using architecture defaults
-- FMA:               Using architecture defaults
-- AVX512:            Using architecture defaults
-- Altivec:           Using architecture defaults
-- VSX:               Using architecture defaults
-- ARM NEON:          Using architecture defaults
-- ARMv8 NEON:        Using architecture defaults
-- S390X ZVECTOR:     Using architecture defaults
-- C++11:             OFF
-- SYCL:              OFF
-- CUDA:              OFF
-- 
CXX:               /usr/bin/c++
 CXX_VERSION:       c++ (Debian 4.9.2-10) 4.9.2
 CXX_FLAGS:         -O3 -DNDEBUG -fPIC -DEIGEN_USE_MKL_ALL -DMKL_ILP64 -fopenmp -m64 -v -pedantic -Wall -Wextra -Wundef -Wcast-align -Wchar-subscripts -Wnon-virtual-dtor -Wunused-local-typedefs -Wpointer-arith -Wwrite-strings -Wformat-security -Wlogical-op -Wdouble-promotion -Wno-psabi -Wno-variadic-macros -Wno-long-long -fno-check-new -fno-common -fstrict-aliasing -ansi
 Sparse lib flags:   

-- ************************************************************
-- 
-- Configured Eigen 3.3.3
-- 
-- Some things you can do now:
-- --------------+--------------------------------------------------------------
-- Command       |   Description
-- --------------+--------------------------------------------------------------
-- make install  | Install Eigen. Headers will be installed to:
--               |     <CMAKE_INSTALL_PREFIX>/<INCLUDE_INSTALL_DIR>
--               |   Using the following values:
--               |     CMAKE_INSTALL_PREFIX: /usr/local
--               |     INCLUDE_INSTALL_DIR:  include/eigen3
--               |   Change the install location of Eigen headers using:
--               |     cmake . -DCMAKE_INSTALL_PREFIX=yourprefix
--               |   Or:
--               |     cmake . -DINCLUDE_INSTALL_DIR=yourdir
-- make doc      | Generate the API documentation, requires Doxygen & LaTeX
-- make check    | Build and run the unit-tests. Read this page:
--               |   http://eigen.tuxfamily.org/index.php?title=Tests
-- make blas     | Build BLAS library (not the same thing as Eigen)
-- make uninstall| Removes files installed by make install
-- --------------+--------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/tr/src/eigen/build_dir

My questions are:

  1. How to remove the default value of CXX_FLAGS?

  2. How to specify that I wish to work with C++11 or even 14?

  3. How to specify that I wish to work with SYCL?

Thank you!


2 Answers

As suggested in my comment, Eigen is a header only library (there are no source files), you do not need to build it. Just include the relevant headers where you want to use Eigen. You may copy the header files (using simple cp) to wherever it seems appropriate to you.

See the Getting Started manual:

In order to use Eigen, you just need to download and extract Eigen's source code (see the wiki for download instructions). In fact, the header files in the Eigen subdirectory are the only files required to compile programs using Eigen. The header files are the same for all platforms. It is not necessary to use CMake or install anything.

And the Eigen wiki mentions:

We use the CMake build system, but only to build the documentation and unit-tests, and to automate installation. If you just want to use Eigen, you can use the header files right away. There is no binary library to link to, and no configured header file. Eigen is a pure template library defined in the headers.

So, if you are not interested in building the unit-tests or the documentation, you do not need cmake for it.

Conclusion: You have to specify the compiler flags (CXX_FLAGS, ...) in the project which uses Eigen.

Note for CMake find_package: see the comment of Andrew W.

like image 66
m7913d Avatar answered Dec 03 '25 18:12

m7913d


As per the answer from @m7913d Eigen is a header only library so you can follow the standard instructions on how to include these.

For 3, there is a guide on how to integrate Eigen with your application, and how to build things https://developer.codeplay.com/products/computecpp/ce/guides/eigen-guide/options-for-building-eigen

like image 45
Rod Burns Avatar answered Dec 03 '25 18:12

Rod Burns



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!