Created attachment 620 [details] A simple example that can reproduce the error I'm having a linker error when compiling a program with the latest development version of Eigen on gcc 4.7.2 (Debian Linux), only when the "-Ofast" option is enabled. The error seems to be happening because the "isnan" and "isinf" functions in MathFunctions.h that use __builtin_isnan and __builtin_isinf (lines 890-895 in my version) are not inlined, and when Eigen is used in more than one cpp file, linking dies because the functions are multiply defined. I've attached a simple example that can reproduce the error, and the error is as below: classb.o: In function `bool Eigen::numext::isnan<long double>(long double const&)': classb.cpp:(.text+0x0): multiple definition of `bool Eigen::numext::isnan<long double>(long double const&)' classa.o:classa.cpp:(.text+0x0): first defined here classb.o: In function `bool Eigen::numext::isnan<double>(double const&)': classb.cpp:(.text+0x10): multiple definition of `bool Eigen::numext::isnan<double>(double const&)' classa.o:classa.cpp:(.text+0x10): first defined here classb.o: In function `bool Eigen::numext::isnan<float>(float const&)': classb.cpp:(.text+0x20): multiple definition of `bool Eigen::numext::isnan<float>(float const&)' classa.o:classa.cpp:(.text+0x20): first defined here classb.o: In function `bool Eigen::numext::isinf<double>(double const&)': classb.cpp:(.text+0x30): multiple definition of `bool Eigen::numext::isinf<double>(double const&)' classa.o:classa.cpp:(.text+0x30): first defined here classb.o: In function `bool Eigen::numext::isinf<float>(float const&)': classb.cpp:(.text+0x50): multiple definition of `bool Eigen::numext::isinf<float>(float const&)' classa.o:classa.cpp:(.text+0x50): first defined here classb.o: In function `bool Eigen::numext::isinf<long double>(long double const&)': classb.cpp:(.text+0x70): multiple definition of `bool Eigen::numext::isinf<long double>(long double const&)' classa.o:classa.cpp:(.text+0x70): first defined here collect2: error: ld returned 1 exit status
Thank you for the detailed report. Fixed: https://bitbucket.org/eigen/eigen/commits/983dc63
I don't know if it is directly related, but we are experiencing several problem similar to the one explained this bug. Here's a log from one CI run on Visual Studio 2012 using the latest Eigen from the default branch: https://ci.appveyor.com/project/traversaro/idyntree/build/1.0.33 In particular it is strange the syntax (isinf./) at line 880 of Eigen/src/Core/MathFunctions.h .
arf, nothing related just a typo
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1102.