macos 10.14、10.15 软件编译时找不到头文件的解决方法

xiaoxiao2025-05-31  35

问题:

今天升级了系统过后 发现phpize报如下错误

$ phpize grep: /usr/include/php/main/php.h: No such file or directory grep: /usr/include/php/Zend/zend_modules.h: No such file or directory grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory Configuring for: PHP Api Version: Zend Module Api No: Zend Extension Api No:

解决

在网上找了解决方案,大多数是软链之类的,但是根本没找到 /Application/Xcode.app。然后看到这篇文章 macOS 10.14软件编译时找不到头文件的解决方法

解决方案:

10.14 重新安装header头文件SDK即可 cd /Library/Developer/CommandLineTools/Packages/ $ open macOS_SDK_headers_for_macOS_10.14.pkg 10.15 xcode-select --install # 安装常用开发工具,如:git等。 sudo mount -uw / # 根目录挂载为可读写,否则无法在/usr/下建立文件,本修改重启前有效。 sudo ln -s "$(xcrun --show-sdk-path)/usr/include" /usr/include export SDKROOT="$(xcrun --show-sdk-path)" # 设置环境变量 echo "export SDKROOT=\"\$(xcrun --show-sdk-path)\"" >> ~/.bash_profile # zsh的自行搞定 sudo DevToolsSecurity -enable # 将系统置于开发模式
转载请注明原文地址: https://www.6miu.com/read-5031039.html

最新回复(0)