【问题标题】:Problem installing/rebuilding Xdebug under Apple Silicon M1在 Apple Silicon M1 下安装/重建 Xdebug 时出现问题
【发布时间】:2021-03-11 04:38:38
【问题描述】:

无法在 Big Sur 下的新 Apple Silicon M1 下安装 XDebug - 使用 pecl install xdebug 并运行 php --ini 后出现以下错误:

PHP Warning:  Failed loading Zend extension 'xdebug.so' (tried: /opt/homebrew/lib/php/pecl/20190902/xdebug.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found.  Did find:
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: mach-o, but wrong architecture
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=22), /opt/homebrew/lib/php/pecl/20190902/xdebug.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so.so, 9): image not found)) in Unknown on line 0

Warning: Failed loading Zend extension 'xdebug.so' (tried: /opt/homebrew/lib/php/pecl/20190902/xdebug.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so, 9): no suitable image found.  Did find:
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: mach-o, but wrong architecture
        /opt/homebrew/lib/php/pecl/20190902/xdebug.so: stat() failed with errno=22), /opt/homebrew/lib/php/pecl/20190902/xdebug.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/xdebug.so.so, 9): image not found)) in Unknown on line 0

我尝试从源代码 (git clone git://github.com/xdebug/xdebug.git) 重新编译 xdebug,结果相同。重新编译 xdebug 时,我可以在 config.m4 中强制使用正确的架构吗? - 还有其他建议吗?

【问题讨论】:

  • 我在做 phpize 之前尝试过这个:./configure --enable-xdebug CC="gcc -arch x86_64" CXX="g++ -arch x86_64" 但现在我得到了:“代码签名在( /usr/local/lib/php/pecl/20200930/xdebug.so)在使用库验证的进程中无效:映射文件没有 cdhash,完全未签名?代码必须至少是临时签名的“

标签: xdebug apple-silicon


【解决方案1】:

我需要指定架构。 它适用于:

arch -arm64 sudo pecl install xdebug

【讨论】:

  • -arm64 为我在 Apple M1 BigSur 11.6 上修复了它
  • 这对我也有用,在 Apple M1 BigSur 11.5.1 (macbook air 2020) 上
【解决方案2】:

不确定这是否是问题所在。但是,我完全重置了我的 M1 Macbook。而这次我只用了arm软件(iterm、homebrew...),这次安装没有任何问题。

【讨论】:

    【解决方案3】:

    您可能需要通过 PECL 安装 Xdebug:

    arch -x86_64 sudo pecl install xdebug
    

    【讨论】:

      【解决方案4】:

      尝试使用pecl install xdebug 安装并收到此错误:

      Build process completed successfully
      Installing '/opt/homebrew/Cellar/php@7.4/7.4.15_1/pecl/20190902/xdebug.so'
      
      Warning: mkdir(): File exists in System.php on line 294
      
      Warning: mkdir(): File exists in /opt/homebrew/Cellar/php@7.4/7.4.15_1/share/php@7.4/pear/System.php on line 294
      ERROR: failed to mkdir /opt/homebrew/Cellar/php@7.4/7.4.15_1/pecl/20190902
      

      我使用此链接中的修复程序 https://patriqueouimet.ca/tip/installing-php-and-pecl-extensions-on-macos 并有所帮助

      您的警告是关于架构的,可能需要删除并重新安装 - 我是从 arm64 终端完成的...

      【讨论】:

        猜你喜欢
        • 2022-08-04
        • 2021-05-08
        • 2022-01-22
        • 2021-04-21
        • 2022-01-06
        • 1970-01-01
        • 2021-03-02
        • 2021-08-13
        相关资源
        最近更新 更多