Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. I've been having trouble installing it. When I ran cmake '/home/brentonhorne/eigen-eigen-5097c01bcdc4 where /home/brentonhorne/eigen-eigen-5097c01bcdc4 is the location of the source directory extracted from the tarball I downloaded from the Eigen website, I received the error:

CMake Error at CMakeLists.txt:8 (message):
In-source builds not allowed.  Please make a new directory (called a build
directory) and run CMake from there.  You may need to remove

-- Configuring incomplete, errors occurred!

Please tell me how to get past this roadblock. I do not understand much programming but if you can explain to me what I need to do in terms of what to paste into terminal I can do it! If it is needed to help me I am running 12.10.

If you need to know the contents of the INSTALL file in the source directory here they are:

Installation instructions for Eigen

Explanation before starting

Eigen consists only of header files, hence there is nothing to compile
before you can use it. Moreover, these header files do not depend on your
platform, they are the same for everybody.

Method 1. Installing without using CMake

You can use right away the headers in the Eigen/ subdirectory. In order
to install, just copy this Eigen/ subdirectory to your favorite location.
If you also want the unsupported features, copy the unsupported/
subdirectory too.

Method 2. Installing using CMake

Let's call this directory 'source_dir' (where this INSTALL file is).
Before starting, create another directory which we will call 'build_dir'.


  cd build_dir
  cmake source_dir
  make install

The "make install" step may require administrator privileges.

You can adjust the installation destination (the "prefix")
by passing the -DCMAKE_INSTALL_PREFIX=myprefix option to cmake, as is
explained in the message that cmake prints at the end.
share|improve this question
As noted in my answer, Eigen is now a package on Ubuntu. So no more compiling from source! – Seanny123 Jul 3 '14 at 12:26
up vote 6 down vote accepted

I'm not familiar with Eigen, but from the error message, it looks like it requires an "out of source" build.

This means that if you have downloaded and extracted Eigen to /home/brentonhorne/eigen-eigen-5097c01bcdc4, then you should create a new directory outside of the Eigen root altogether, e.g. /home/brentonhorne/build_eigen and run CMake from there. I guess something like:

mkdir /home/brentonhorne/build_eigen
cd /home/brentonhorne/build_eigen
cmake /home/brentonhorne/eigen-eigen-5097c01bcdc4
sudo make install
share|improve this answer
Thanks, mate, I'll give it a shot. – Brenton Horne Jan 31 '13 at 21:51
I received the same error again after the cmake line... CMake Error at CMakeLists.txt:8 (message): In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. -- Configuring incomplete, errors occurred! – Brenton Horne Jan 31 '13 at 21:57
There may be a file in your Eigen source directory called "CMakeCache.txt". This is a file which CMake generates when run, and which caches a load of variables to save it looking for the same set of things on every run. If you tried running CMake in your Eigen source once, it could have left behind this CMakeCache.txt file. No matter where you subsequently run CMake from, the cache file will make it appear as if you're running from the Eigen source. So you need to delete this file if it exists. If this still doesn't work, the last option is to do a fresh checkout and try from scratch. – Fraser Jan 31 '13 at 22:54
Thanks, mate, it worked perfectly, I'll accept your answer and upvote it! – Brenton Horne Jan 31 '13 at 23:20
It worked for me , thanks!!! – richardtk_1 May 15 at 23:54

It should be noted that Eigen library can be installed as a package. sudo apt-get install libeigen3-dev for the most recent library and sudo apt-get install libeigen2-dev for the one mentioned in this question.

share|improve this answer

Well, I installed it myself and it's working perfectly. Here is what I did (which is same as what I posted before):

  • Download Eigen 3.1.2 from
  • Open a terminal (Ctrl+Alt+T) and run:
cd ~/Downloads
tar xzf eigen-eigen-5097c01bcdc4.tar.bz2
cd eigen-eigen-5097c01bcdc4
sudo cp -r Eigen /usr/include/
  • Done!
  • Copy the Eigen directory to /usr/include.

You'd neet root user privileges to do that. So, open a terminal, browse to the directory containing the Eigen directory, and run sudo cp -r Eigen /usr/include/.

  • To include a header file, say Dense, from the Eigen directory use
#include <Eigen/Dense>
share|improve this answer
You don't have to do anything fancy. Just copy the directory as I've written in the updated answer. – green Feb 1 '13 at 8:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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