CMake, Boost multiprecision float128 and Clang “fatal error: ‘quadmath.h’ file not found”

huangapple go评论76阅读模式
英文:

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

问题

我正在使用CMake在Ubuntu 22.04上使用Clang14编译我的项目。我在CMake方面不是很高级,但我勉强能够应付。

我刚刚从Boost版本1.74中添加了float128:

#include <boost/multiprecision/float128.hpp>

boost::multiprecision::float128 var = 0.1;

但不幸的是,我现在遇到了编译器错误:

/usr/include/boost/multiprecision/float128.hpp:40:10: 致命错误:找不到'quadmath.h'文件

我可以看到我的系统有这个库:/usr/lib/gcc/x86_64-linux-gnu/11/libquadmath.a,但我不确定在我的CMake脚本中需要做什么。我尝试过:

find_library(quadmath NAMES quadmath.a)

但这没有起作用。我可能需要将头文件添加到包含路径,但我不确定它在哪里/如何添加?我还读到float128使用GCC或Intel的float128类型。这是否与问题相关?

英文:

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 &lt;boost/multiprecision/float128.hpp&gt;

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: &#39;quadmath.h&#39; 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?

答案1

得分: 0

抱歉,clang不支持quadmath:github.com/boostorg/math/issues/181

英文:

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

huangapple
  • 本文由 发表于 2023年6月12日 08:31:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76453037.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定