V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MrMike
V2EX  ›  macOS

Mac 安装 Swoole 报错: error: no member named 'isless' in the global namespace using ::isless;

  •  
  •   MrMike · 2020-04-24 16:03:10 +08:00 · 2039 次点击
    这是一个创建于 1476 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2020-07-31 00:51:54 +08:00
    iwktd1220
        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/
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3368 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 12:06 · PVG 20:06 · LAX 05:06 · JFK 08:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.