由brew安装的Protoc似乎不适用于自定义构建规则

发布于 2025-01-14 01:36:57 字数 651 浏览 7 评论 0原文

我有一台 M1,带有 XCode 13.2.1 和 monterey。

我已经按照官方步骤安装了brew,并且还执行了额外的两个步骤,因此新的brew路径被添加到我的路径中。

另外,我已将 export PATH=/opt/homebrew/bin:$PATH 添加到我的 .zshrc

我已经安装了 protobufswift-protobuf 与brew,我可以在终端中运行它们而不会出现错误。

但是,当我在 XCode 构建规则的自定义脚本中使用 protoc 时,出现以下错误:

/bin/sh: protoc: command not found
/bin/sh: line 7: protoc: command not found
/bin/sh: line 9: protoc: command not found

我可以添加从 which protoc 获得的 protoc 路径 但我不确定这是否会给其他架构带来问题。

知道为什么如果 protoc 在我的终端中运行,它没有在 XCode 构建规则中的自定义脚本中运行吗?

I've got a M1, with XCode 13.2.1 and monterey.

I've installed brew following the official steps and also I did the extra two steps so the new brew path is added to my path.

Additionally I've added export PATH=/opt/homebrew/bin:$PATH to my .zshrc

I've installed protobuf and swift-protobuf with brew and I can run both in the terminal with no errors.

But when I use protoc in a custom script in XCode build rules, I get the following error:

/bin/sh: protoc: command not found
/bin/sh: line 7: protoc: command not found
/bin/sh: line 9: protoc: command not found

I could add the path of protoc which I got from which protoc but I'm not sure if that would make a problem for other architectures.

Any idea why if protoc is running in my terminal, it's not running in custom script in XCode Build Rules?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

本宫微胖 2025-01-21 01:36:57

/usr/local/bin

如果没有 bin 文件夹, 创建它。也许它在终端上不起作用,您可以从 Finder 中执行此操作

之后,从终端转到文件夹并写入

sudo ln -s /opt/homebrew/bin/protoc protoc

sudo ln -s /opt/homebrew/bin/protoc-gen-swift protoc-gen-swift

退出 Xcode,清理构建文件夹并重试

Go to

/usr/local/bin

if there isn't the bin folder create it. Maybe it doesn't work from terminal, you can do it from Finder

After that go to the folder from the terminal and write

sudo ln -s /opt/homebrew/bin/protoc protoc

and

sudo ln -s /opt/homebrew/bin/protoc-gen-swift protoc-gen-swift

Quit Xcode, clean build folder and retry

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文