Opened 10 years ago

Closed 10 years ago

Last modified 5 years ago

#8265 closed Bugs (fixed)

quadmath.h not found on clang

Reported by: Nathan Ridge Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

When trying to compile:

#include <boost/math/special_functions/sign.hpp>

with clang, I get the following compiler error:

In file included from test.cpp:1:
In file included from boost/math/special_functions/sign.hpp:16:
boost/math/tools/config.hpp:215:10: fatal error: 'quadmath.h' file not found
#include <quadmath.h>
         ^

Change History (10)

comment:1 by John Maddock, 10 years ago

Resolution: fixed
Status: newclosed

(In [83356]) Remove dependency on quadmath.h. Fixes #8265.

comment:2 by Nathan Ridge, 10 years ago

Resolution: fixed
Status: closedreopened

Thanks for the fix. Unfortunately, the example given in the description still doesn't compile with clang. This time the error is:

In file included from test.cpp:1:
In file included from boost/math/special_functions/sign.hpp:17:
In file included from boost/math/special_functions/math_fwd.hpp:28:
boost/math/policies/policy.hpp:819:18: error: use of undeclared identifier '__float128'
struct precision<__float128, Policy>
                 ^

comment:3 by John Maddock, 10 years ago

OK some more questions:

  • Do you know if it's possible to detect when clang supports __float128? Recent SVN Trunk versions certainly do so?
  • Presumably your version can't handle libstdc++ as that also refers to __float128 in <type_traits> ?
  • Which clang version are you using also?

Thanks!

comment:4 by Nathan Ridge, 10 years ago

I am using a very recent clang (version 3.3, trunk revision 176405). I am using it with libstdc++, which it handles just fine. The libstdc++ version it uses is from a recent GCC build (4.8.0 20130224).

comment:5 by Nathan Ridge, 10 years ago

Regarding <type_traits>, I did a bit of digging and discovered the following:

  • <type_traits> can only be used in C++11 mode (obviously)
  • There are two flags that get clang to operate in C++11 mode: -std=c++11 and -std=gnu++11. If the -std=c++11 flag is used, the symbol __STRICT_ANSI__ gets defined. If the -std=gnu++11 flag is used, that symbol does not get defined.
  • The use of __float128 in <type_traits> is guarded by !defined(__STRICT_ANSI__)
  • I usually compile my code with the -std=c++11 flag. In this configuration, <type_traits> compiles just fine. If I change the flag to -std=gnu++11, I get the same error about __float128 in <type_traits> that I get with Boost.Math.

comment:6 by Nathan Ridge, 10 years ago

A quick google search suggests that clang doesn't have any support for __float128 yet.

comment:7 by John Maddock, 10 years ago

You're right, I found this open bug report: http://llvm.org/bugs/show_bug.cgi?id=13530 on this very issue. So I'll unconditionally disable float128 support when the compiler is clang for now.

comment:8 by John Maddock, 10 years ago

Resolution: fixed
Status: reopenedclosed

(In [83369]) Restrict float128 support to GCC only for now. Fixes #8265.

comment:9 by anonymous, 5 years ago

I have the same problem, but with float128, can you help me, please?

/usr/local/include/boost/multiprecision/float128.hpp:40:10: fatal error:

'quadmath.h' file not found

#include <quadmath.h>

~

comment:10 by John Maddock, 5 years ago

clang has no support for float128 and libquadmath, so you're out of luck: that header is supported by gcc and Intel compilers only.

Note: See TracTickets for help on using tickets.