FS#39727 - [eigen] Eigen folder is inside /usr/include/eigen3 and not /usr/include/

Attached to Project: Arch Linux
Opened by Kashyap Chhatbar (decryptedepsilon) - Thursday, 03 April 2014, 14:13 GMT
Last edited by Dave Reisner (falconindy) - Saturday, 05 April 2014, 18:03 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

There are multiple versions of eigen library (version 2 and 3) and it installs in /usr/include/eigen2 and /usr/include/eigen3 respectively. If we try to use the headers from eigen library it throws the following error:

fatal error: Eigen/Dense: No such file or directory

Additional info:
* package version(s): eigen3 eigen2
* test.cpp

#include <fstream>
#include <iostream>
#include <Eigen/Dense>
using namespace std;

int main()
{
char str[10];

//Creates an instance of ofstream, and opens example.txt
ofstream a_file ( "example.txt" );
// Outputs to example.txt through a_file
a_file<<"This text will now be inside of example.txt";
// Close the file stream explicitly
a_file.close();
//Opens for reading the file
ifstream b_file ( "example.txt" );
//Reads one string from the file
b_file>> str;
//Should output 'this'
cout<< str <<"\n";
cin.get(); // wait for a keypress
// b_file is closed implicitly here
}


Steps to reproduce:
* Install eigen3 package using pacman -S eigen3
* Create a test.cpp file which uses an Eigen header
* Try to compile and compilation fails resulting in fatal error: No such file or directory found

Steps to solve:
* Provide a symlink of /usr/include/eigen3/Eigen to /usr/include/Eigen
* It successfully compiles
This task depends upon

Closed by  Dave Reisner (falconindy)
Saturday, 05 April 2014, 18:03 GMT
Reason for closing:  Not a bug
Additional comments about closing:  pkg-config files provide necessary CFLAGS to make this Just Work™
Comment by Dave Reisner (falconindy) - Thursday, 03 April 2014, 14:27 GMT
I think it would be more prudent to simply use the pkg-config file to determine the parent include, i.e.

$ pkg-config --cflags eigen
-I/usr/include/eigen3

This way, your code has "#include <Eigen/Dense>" and it Just Works™

Unrelated, the pkg-config file is in the wrong directory, but this doesn't matter for your purposes (and seems to be an upstream bug).
Comment by Doug Newgard (Scimmia) - Thursday, 03 April 2014, 14:30 GMT
It should also compile successfully if you add in the cflags included with the pkgconfig file: "-I/usr/include/eigen3". There's a bug with where the pkgconfig file is installed, though.

You should never assume where headers are installed, but get the locations with pkg-config. In this case, upstream is installing them to the eigen3 dir, so it is correct.
Comment by Kashyap Chhatbar (decryptedepsilon) - Thursday, 03 April 2014, 14:53 GMT
Many Thanks... Able to compile successfully now..

Loading...