I am using Ubuntu 14.04 and I want to install eigen 3.3 in the Ubuntu. I tried to download newest version of Eigen 3 (3.3) and install as following

mkdir build
cd build
cmake ..
sudo make install 

The output likes

-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Skyline/SkylineStorage.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/RandomSetter.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/MarketIO.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Splines/SplineFitting.h
-- Installing: /usr/local/include/eigen3/unsupported/Eigen/src/Splines/Spline.h

However, when I check the my current eigen version with dpkg -p libeigen3-dev, the output is

Package: libeigen3-dev
Priority: extra
Section: libdevel
Installed-Size: 3729
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Source: eigen3
Version: 3.2.0-8
Provides: libeigen2-dev
Depends: pkg-config
Suggests: libeigen3-doc, libmrpt-dev
Size: 494158

It shown my setup does not finish. How can I install the eigen version in my Ubuntu? Thank all

This is error when I compile with CmakeList.txt at source code

-- ===============================================================
-- ============ Configuring CompileSettings  =====================
-- ===============================================================
-- ============= Look for required libraries =====================
-- Looking for Eigen Library with minimum version 3.2.90
-- Looking for Eigen via User Provided (or Cached) location
-- Eigen version 3.2.0 found in /usr/include/eigen3
CMake Warning at cmake/FindEigen.cmake:62 (message):
  Eigen version is less than requred version 3.2.90
Call Stack (most recent call first):
  cmake/FindEigen.cmake:73 (Eigen_Check_Version)
  CMakeLists.txt:23 (FIND_PACKAGE)

CMake Error at /usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find Eigen (missing: EIGEN_VERSION_OK) (Required is at least
  version "3.2.90")
Call Stack (most recent call first):
  /usr/local/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindEigen.cmake:74 (find_package_handle_standard_args)
  CMakeLists.txt:23 (FIND_PACKAGE)
  • 1
    Unless you take additional steps (such as using the checkinstall program in place of make install), the dpkg system will know nothing about programs installed from source in this way. – steeldriver Dec 13 '16 at 12:20
  • Sorry. What does it mean? How could I fix my issue. I surely that I did not install 3.3 version successfully – John Dec 13 '16 at 12:23
  • What makes you think it was unsuccessful? What does pkg-config --modversion eigen3 say? What version do you actually get when you try to build stuff? – steeldriver Dec 13 '16 at 12:29
  • Because I run a source code which require the version of Eigen >=3.2.90 and it shown that my current version is still 3.2.0 – John Dec 13 '16 at 12:37

Eigen c++ is a header only library: you don't have to install it, you just download it, unzip it and link your code against it.

For example, if your code is in my_favorite_cpp_folder, you do:

cd my_favorite_cpp_folder

and, assuming your compiler is gcc and the eigen headers are in /usr/local/include/eigen3/unsupported/ and the name of your source file is my_favorite_cpp_source_file.cpp, you compile and code and link it to the eigen headers by doing:

g++ -I /usr/local/include/eigen3/ my_favorite_cpp_source_file.cpp -o my_favorite_cpp_source_file

(from your code output posted above, the eigen headers are in /usr/local/include/eigen3/ in your computer)

|improve this answer|||||
  • Thank you. However, I compile an open source code from cmake. It use the line to check Eigen 3 version # Add Eigen dependencies FIND_PACKAGE(Eigen 3.2.90 REQUIRED). I did not find any setting lib path in the CmakeList.txt – John Dec 23 '16 at 2:09
  • in any case your problem is not with installing eigen, it is with installing that open source library. You should put up the errors messages you get when installing that library in your question, those will be informative. – user2413 Dec 23 '16 at 9:36
  • Yes. I updated the error and source link – John Dec 23 '16 at 12:22
  • do gedit /usr/local/include/eigen3/Eigen/src/Core/util/Macros.h look for the lines #define EIGEN_WORLD_VERSION to #define EIGEN_MINOR_VERSION copy and post those. – user2413 Dec 23 '16 at 12:40
  • 1
    Thanks. It worked now. My installed software just a project. – John Dec 23 '16 at 14:20

For those simply requiring a reasonably recent version of Eigen 3 on Ubuntu and similar Debian-based distros (...which is the common case), installing the existing libeigen3-dev package suffices: e.g.,

sudo apt install libeigen3-dev

Manually downloading and installing Eigen 3 is probably overkill for most use cases.

|improve this answer|||||
  • 1
    Seems simple but failed for me :( – Yair Daon Jul 25 '17 at 3:11
  • 6
    libeigen3-dev installs Eigen 3.2, he is asking for 3.3, so this answer is wrong if you need 3.3. – Gines Hidalgo May 8 '18 at 17:16
  • on Ubuntu 19.04 the package gives you 3.3.7 ... whereas when you install from src tree github.com/PX4/eigen you get 3.3.90 as of 20190712 – Scott Stensland Jul 12 '19 at 16:04

dpkg only knows about software that you have installed by Ubuntu's standard package management tools. But that's not how you installed eigen. You have installed from the source code, and as such dpkg doesn't know it. The output of dpkg -p libeigen3-dev is not about the eigen that you installed, but about a different version of eigen, installed using the standard package management tools.

Based on your output of sudo make install, the version of eigen that you installed from source is ready to use, its files are available in /usr/local/include/eigen3/unsupported/Eigen/src.

|improve this answer|||||

After extracting the compressed folder check the INSTALL file. I used the second option of installing using cmake. After which "eigen3" folder with the header files was created in /usr/local/include/ folder.

In your project you can include eigen headers like this:

#include <eigen3/Eigen/Dense>

I forgot to mention this. Since the header files are in /usr/local/include/ folder you don't need to compile your source-code files against them using "g++ -I .... ."

Good luck!

|improve this answer|||||

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.