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

问题:

今天升级了系统过后 发现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:

解决

解决方案:

  • 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 # 将系统置于开发模式
  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值