Search code examples
c++boostcmakeclangboost-multiprecision

CMake, Boost multiprecision float128 and Clang "fatal error: 'quadmath.h' file not found"


I'm using CMake to compile my project with Clang14 on Ubuntu 22.04. I'm not very advanced with CMake, but I get by.

I've just added float128 from my Boost version 1.74:

#include <boost/multiprecision/float128.hpp>

boost::multiprecision::float128 var 0.1;

to my project but unfortunately I now get the compiler error:

/usr/include/boost/multiprecision/float128.hpp:40:10: fatal error: 'quadmath.h' file not found

I can see my system has the library: /usr/lib/gcc/x86_64-linux-gnu/11/libquadmath.a

but I am unsure what I need to do in my CMake script? I tried:

find_library(quadmath NAMES quadmath.a)

but this hasn't worked. I probably need to add the header to the include path but I'm not sure where it is/how to do this?

I have also read that float128 uses GCC or Intel float128 type. Is this related to the issue?


Solution

  • Sadly, clang does not support quadmath: github.com/boostorg/math/issues/181