macOS Catalina, 10.15.3
本地安装 swoole4 时,安装步骤是按照 swoole 官方的文档进行安装的。 make && sudo make install
就一直报错: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isless' in the global namespace using ::isless;
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:320:9: error: no member named 'isinf' in the global namespace using ::isinf;
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isnan' in the global namespace using ::isnan;
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isnormal' in the global namespace using ::isnormal;
检查了下 cmath 文件,在 137 行左右: // C99
bool signbit(arithmetic x);
int fpclassify(arithmetic x);
bool isfinite(arithmetic x); bool isinf(arithmetic x); bool isnan(arithmetic x); bool isnormal(arithmetic x);
bool isgreater(arithmetic x, arithmetic y); bool isgreaterequal(arithmetic x, arithmetic y); bool isless(arithmetic x, arithmetic y); bool islessequal(arithmetic x, arithmetic y); bool islessgreater(arithmetic x, arithmetic y); bool isunordered(arithmetic x, arithmetic y);
但是这部分内容是被注释了的,这里面涉及到的名称都在报错里面,我试着去掉注释,保存,再执行 swoole 安装,还是报错。 在 cmath 文件中: using ::acos; using ::acosf; using ::asin; using ::asinf; using ::atan; using ::atanf; using ::atan2; using ::atan2f; using ::ceil; using ::ceilf; using ::cos; using ::cosf; using ::cosh; using ::coshf;
这部分的函数名(不清楚是不是该这样定义)会跳转到 math.h 文件中。
对 c++完全不懂,请问该怎么解决这样的问题呢?
网上查了半天,我更新了 brew update && brew upgrade,也重装了 xcode 和 xcode tools,还是没解决问题。
1
iwktd1220 2020-07-31 00:51:54 +08:00
我觉得可能是和我之前遇到编译 lldb 出现的问题差不多。
主要就是 MacOS 的 toolchain 的问题,我解决这个问题的方法就是设置 SDK 为 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk ,而不是用默认的 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk 参考链接: https://github.com/PointCloudLibrary/pcl/issues/2601#issuecomment-525750226 我的博客也有说如何解决: https://blog.iwktd.com/index.php/archives/14/ |