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

Compile problems on latest MacOS/trunk

Tags: None
(comma "," separated)
Seb
Registered Member
Posts
99
Karma
0
Hi there,

Using the lastest development version of Eigen2 (from today morning) and compiling it on MacOS X 10.6 I obtain a nasty compile error. The reason is a different API of std::pow comparing MacOS and Linux. I insert the console output in here:

Core/StableNorm.h:
In member function ‘typename Eigen::NumTraits<typename
Eigen::ei_traits<T>::Scalar>::Real Eigen::MatrixBase<Derived>::blueNorm() const’:
/Users/bucher/develop/SLangTNG_shared_64/Externals/eigen2/Eigen/src/
Core/StableNorm.h:118: error: call of overloaded ‘pow(int&, int&)’ is ambiguous
/usr/include/architecture/i386/math.h:343: note: candidates are: double pow(double,
double)
/usr/include/c++/4.2.1/cmath:357: note: float std::pow (float, float)
/usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long
double, long double)
/usr/include/c++/4.2.1/cmath:365: note: double std::pow (double, int)
/usr/include/c++/4.2.1/cmath:369: note: float std::pow (float, int)
/usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long
double, int)
/Users/bucher/develop/SLangTNG_shared_64/Externals/eigen2/Eigen/src/
Core/StableNorm.h:120: error: call of overloaded ‘pow(int&, int&)’ is ambiguous
/usr/include/architecture/i386/math.h:343: note: candidates are: double pow(double,
double)
/usr/include/c++/4.2.1/cmath:357: note: float std::pow (float, float)
/usr/include/c++/4.2.1/cmath:361: note: long double std::pow(long
double, long double)
/usr/include/c++/4.2.1/cmath:365: note: double std::pow (double, int)
/usr/include/c++/4.2.1/cmath:369: note: float std::pow (float, int)
/usr/include/c++/4.2.1/cmath:373: note: long double std::pow(long
double, int)


gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


This error does not appear on various Linux systems. It also works fine with the official release of Eigen, version 2.0.6

Thanks for listening and for supporting this library!
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Seb:
- you can quickly fix this error by editing Core/StableNorm.h and making replacing "iexp" by "RealScalar(iexp)" in these calls to std::pow(). The problem is that GCC is confused because Mac provides only pow(int,int) and pow(double,double) and here one is trying to call pow(double,int).

Gael:
questions/comments:
1) isn't radix always just equal to 2? If yes, replace pow(radix,iexp) by 1<<iexp ?
2) The assertion at line 115 guards for something that isn't a memory error, and that is purely a platform check. Hence it should be moved to unit tests. Right?


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
ok problem fixed now. I've also moved the platform check to the unit tests as you suggested.
Seb
Registered Member
Posts
99
Karma
0
Thanks. Both of you rock!


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]