Installing Eigen3 library on RHEL8 and Windows 11

These are just some quick notes on installing Eigen3 (v3.4.0) library on RHEL-8 and Windows-11 (something I’m experimenting with for a side project)…

RHEL-8

wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz
tar xf eigen-3.4.0.tar.gz
cd eigen-3.4.0/
mkdir build
cd build/
cmake ..
sudo make install

The header files should now be in the appropriate system path (/usr/local/include)

Window 11

(tested with cmake v3.27.5 and VS2022)

Download and unzip https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip

cd eigen-3.4.0/
mkdir build
cd build/
cmake ..

Open VS2022 as an administrator, then open the cmake generated build\Eigen3.sln (I changed the profile from Debug to Release out of habit, but I don’t think this is necessary for me since I just care about the header files being installed). Admin mode is “probably” needed because we want to install to the default system folders (program files x86… again, we just care about the headers).

Don’t “build all”. Select and “build” the “INSTALL” project (you can also just manually copy the header files wherever you want, but I prefer to go through this as a matter of routine).

Add an environment variable named “EIGEN3_INCLUDE_DIR” and set it to “C:\Program Files (x86)\Eigen3\include”.

In your CMakeLists.txt file for projects referring to Eigen3, add something like this (yes, there are fancier ways of doing this – this is just quick and simple for my immediate needs):

INCLUDE_DIRECTORIES("$ENV{EIGEN3_INCLUDE_DIR}")

Leave a Comment