Welcome to the KDE Community Forums, the official forum board for KDE.
You are currently viewing the forums as an unregistered user. Registration allows you to post and discuss topics, receive private messages, vote on ideas, subscribe to topics and many such great features. Registration is a simple process and completely free. So register now and be a part of the community!

Compile problems on latest MacOS/trunk



Seb

Registered Member

Posts: 69

Karma: 0

Compile problems on latest MacOS/trunk

Post Mon Oct 05, 2009 3:29 pm

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!

Moderator User avatar

bjacob

Moderator

Posts: 293

Karma: 0

France

Re: Compile problems on latest MacOS/trunk

Post Mon Oct 05, 2009 5:39 pm

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!

Moderator User avatar

ggael

Moderator

Posts: 205

Karma: 0

Gender:  Male

France

Re: Compile problems on latest MacOS/trunk

Post Tue Oct 06, 2009 8:22 am

ok problem fixed now. I've also moved the platform check to the unit tests as you suggested.
ggael, proud to be a member of KDE forums since 2008-Dec.



Seb

Registered Member

Posts: 69

Karma: 0

Re: Compile problems on latest MacOS/trunk

Post Tue Oct 06, 2009 8:59 am

Thanks. Both of you rock!


Who is online

Users browsing this forum: No registered users and 2 guests