[Trilinos-Users] [EXTERNAL] Sacado compilation error

Phipps, Eric T etphipp at sandia.gov
Mon Oct 6 10:44:42 MDT 2014


Hi Simone,

This is a problem that I’ve known about ever since Apple replaced their system compiler with clang, and stems from Sacado’s injections of its overloads into the std namespace (so you can do things like std::sin(x) where x is a Sacado type and have it do the right thing).  However I wasn’t aware that it could easily be fixed by including the cmath header in Sacado_MathFunctions.hpp.  I tried that and verified it does appear to work, and it also doesn’t appear to cause problems with other compilers.  So I pushed this change to the development branch of Trilinos today.  That will show up in the public Trilinos git repo soon, and a new release of Trilinos should be coming out later this month with this change.

Thanks so much for suggesting this change!  I really though I was going to have to pull out Sacado’s namespace injections, which would make Sacado significantly more difficult to use.

-Eric

From: "<Simone Rossi>", "Ph.D." <simone.rossi at duke.edu<mailto:simone.rossi at duke.edu>>
Date: Friday, October 3, 2014 at 10:47 AM
To: "trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>" <trilinos-users at software.sandia.gov<mailto:trilinos-users at software.sandia.gov>>
Subject: [EXTERNAL] [Trilinos-Users] Sacado compilation error


Dear all,

I started enabling the Sacado package when compiling Trilinos.

When compiling with clang, I always get the following error


Building CXX object packages/sacado/test/tradoptest/CMakeFiles/Sacado_hesopcheck.dir/hesopcheck.cpp.o
In file included from /TPL/trilinos-11.8.1-Source/packages/sacado/test/tradoptest/hesopcheck.cpp:36:
In file included from /TPL/trilinos-11.8.1-Source/packages/sacado/src/Sacado_trad.hpp:39:
In file included from /TPL/trilinos-11.8.1-Source/packages/sacado/src/Sacado_trad_Traits.hpp:35:
In file included from /TPL/trilinos-11.8.1-Source/packages/sacado/src/Sacado_Traits.hpp:56

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:664:35: error:
      no matching function for call to 'fabs'
abs(double __x) _NOEXCEPT {return fabs(__x);}​


I temporarily  solved this issue by including in Sacado_MathFunctions.hpp, the c math library, that is:

#include <cmath>

I got this compilation error in several versions of Trilinos,
but I do not know if this is the best way to solve this issue.
Let me know if you have any suggestion
Thank you very much,
All the best,
Simone



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://software.sandia.gov/pipermail/trilinos-users/attachments/20141006/47e61453/attachment.html>


More information about the Trilinos-Users mailing list