dftlibs / xcfun

XCFun: A library of exchange-correlation functionals with arbitrary-order derivatives
https://dftlibs.org/xcfun/
Mozilla Public License 2.0
57 stars 32 forks source link

cannot compile Dirac after upgrade mac to High Sierra #30

Closed gvozdetsky closed 6 years ago

gvozdetsky commented 6 years ago

In file included from /Users/gvozdetsky/dirac/src/xcfun/src/functionals/ldaerfc.cpp:2: /Users/gvozdetsky/dirac/src/xcfun/src/functionals/pw92eps.h:21:13: error: call to 'cbrt' is ambiguous return (cbrt(2)/(cbrt(2)-1))(d.a_43+d.b_43)d.n_m13/d.n - 1/(cbrt(2)-1); ^~~~ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:1041:1: note: candidate function [with _A1 = int] cbrt(_A1 lcpp_x) _NOEXCEPT {return ::cbrt((double)lcpp_x);} ^ /Users/gvozdetsky/dirac/src/xcfun/src/taylor/taylor_math.h:261:10: note: candidate function [with T = int] inline T cbrt(T x) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/math.h:435:15: note: candidate function extern double cbrt(double); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:1035:46: note: candidate function inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbr... ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:1036:46: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbr...

robertodr commented 6 years ago

This problem had surfaced already in #22 and was fixed by #27. I think you are on an old version of XCFun. Can you try with the current master?

bast commented 6 years ago

The problem is that the DIRAC code uses a relatively old version of XCFun. Might not be super simple to update since interfaces have changed a lot. What we can and possibly should do instead is to apply the fix on the DIRAC side (the code is statically copied, no submodule or external project).

robertodr commented 6 years ago

Then the trick is to use double instead of int for that call to cbrt. That is use 2.0 instead of 2.

bast commented 6 years ago

OK I will apply it to the DIRAC source code so that at least it gets into the soon to be released DIRAC17 and @gvozdetsky you can perhaps apply it locally until then?

gvozdetsky commented 6 years ago

Ok, thank you very much!

bast commented 6 years ago

It is now fixed on the DIRAC side and will be part of DIRAC17, to be released a month from now. Thanks for reporting! Closing.