This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen3, MinGW: compilation failure, intrin.h does not exist

Tags: None
(comma "," separated)
mattd
Registered Member
Posts
28
Karma
0
Hi!

Currently trying out Eigen 3.0-beta2 (2010-10-15)

There seems to be a problem in file "eigen\Eigen\Core" -- right here:
Code: Select all
// include files
#if (defined __GNUC__) && (defined __MINGW32__)
#include <intrin.h>
//including intrin.h works around a MINGW bug http://sourceforge.net/tracker/?func=detail&atid=102435&aid=2962480&group_id=2435
//in essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do).  However,
//intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations with conflicting linkage.  The linkage for intrinsics
//doesn't matter, but at that stage the compiler doesn't know; so, to avoid compile errors when windows.h is included after Eigen/Core,
//include intrin here.


Despite the claim made in the above comment, there is no "intrin.h" file in MinGW.
Tested both under the g++-4.3.0-20080502-mingw32-alpha as well as g++.exe (GCC) 4.5.0 (which is the current official MinGW.org release).

Incidentally, neither does "include/windows.h" in any of the above versions include any header file containing "intrin" in its name.

This prevents a successful compilation -- e.g. if a file "example.cpp" contains
Code: Select all
#include "Eigen/Dense"
in line 4, then the compilation fails:
Code: Select all
In file included from ../Eigen/Dense:1:0,
                 from example.cpp:4:
../Eigen/Core:97:26: fatal error: intrin.h: No such file or directory
compilation terminated.


I've tried two workarounds:
(0) comment out #include <intrin.h> (since it doesn't exist on MinGW)
(1) since my CPU's ISA is x86, replace it with #include <x86intrin.h> (which exists in MinGW since at least GCC 4.3.0)
Then, the code seemingly compiles, but...

What is the right'n'proper way to solve it (and why)?
kavehkh
Registered Member
Posts
3
Karma
0
I have had a similar problem recently after I upgraded mingw and eigen. Not sure which one has changed. In any case the new mingw does not have that file and if I comment out the line in the include file, it does compile but when I run my code, memory allocation breaks down. The code compiles and runs with no problem on linux though. I will try changing it to <x86intrin.h> next.

EDIT: Changing to <x86intrin.h> had no effect on the memory allocation then I removed "-msse2" compiler flags and it worked...
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Please file a bug about this, and let us know when you've found the fix/work-around. Not all eigen developers read the forum.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
mattd
Registered Member
Posts
28
Karma
0
Thanks for the reply, bug report here:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=125

kavehkh, I'm also experiencing problems, especially when using OpenMP together with SSE2 compilation flags (problems == segfaults that disappear when flags disabled).


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient