inf*_*ker 96 homebrew protocol-buffers
我想使用终端命令行在mac上安装旧版本的Google Protocol Buffers(protobuf-2.4.1).我尝试过brew install protobuf,但已安装最新版本2.5.0.是否可以从终端安装旧版本.
谢谢
Joh*_*ore 143
在Mac上从源代码构建protobuf 2.4.1存在一些问题.还有一个补丁也必须应用.所有这些都包含在自制的protobuf241公式中,所以我建议使用它.
要安装协议缓冲区版本2.4.1,请在终端中键入以下内容:
brew tap homebrew/versions
brew install protobuf241
Run Code Online (Sandbox Code Playgroud)
如果您已经尝试从源安装协议缓冲区版本,则可以在终端中键入以下内容以使源代码被自制软件版本覆盖:
brew link --force --overwrite protobuf241
Run Code Online (Sandbox Code Playgroud)
通过键入以下内容检查您是否安装了正确的版本:
protoc --version
Run Code Online (Sandbox Code Playgroud)
它应该显示2.4.1
小智 69
这不是通过brew,但最终结果是一样的.
步骤4-7来自protobuf tarball的README.txt文件.
dan*_*nvk 34
这是新的一年,protobufHomebrew 版本和最新版本之间出现了新的不匹配.截至2016年2月,brew install protobuf将为您提供2.6.1版本.
如果您想要3.0 beta版本,可以使用以下命令安装:
brew install --devel protobuf
Run Code Online (Sandbox Code Playgroud)
小智 12
出于某种原因,我需要在我的OS X El Capitan项目中使用protobuf 2.4.1.然而,自制软件已从其公式中删除了protobuf241.我根据@kksensei的答案手动安装它,并且必须在此过程中修复一些错误.
在制作过程中,我得到3个错误如下:
google/protobuf/message.cc:130:60: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
return ParseFromZeroCopyStream(&zero_copy_input) && input->eof();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
class _LIBCPP_TYPE_VIS basic_istream;
^
google/protobuf/message.cc:135:67: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
return ParsePartialFromZeroCopyStream(&zero_copy_input) && input->eof();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
class _LIBCPP_TYPE_VIS basic_istream;
^
google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template 'std::__1::basic_ostream<char, std::__1::char_traits<char> >'
return output->good();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:110:28: note: template is declared here
class _LIBCPP_TYPE_VIS basic_ostream;
^Run Code Online (Sandbox Code Playgroud)
(对不起,当代码包含'''时,我不知道如何附加代码)
如果你得到同样的错误,请编辑src/google/protobuf/message.cc,#include <istream>在文件顶部添加并$ make再次执行,并且应该没有错误.之后呢$ sudo make install.安装完成后$protoc --version应显示正确的结果.
Van*_*Van 12
来自https://github.com/paulirish/homebrew-versions-1.适合我!
brew install https://raw.githubusercontent.com/paulirish/homebrew-versions-1/master/protobuf241.rb
Run Code Online (Sandbox Code Playgroud)
小智 7
根据您的操作系统下载 zip 文件(例如:protoc-3.7.0-osx-x86_64.zip)。这也适用于其他操作系统。
将 protoc-3/bin/protoc 中的可执行文件移动到 PATH 中的目录之一。在 Mac 中,我建议将其放入 /usr/local/bin
(可选)还有一个包含文件,可以添加。这是 README.md 的片段
If you intend to use the included well known types then don't forget to
copy the contents of the 'include' directory somewhere as well, for example
into '/usr/local/include/'.
Please refer to our official github site for more installation instructions:
https://github.com/protocolbuffers/protobuf
Run Code Online (Sandbox Code Playgroud)
brew install --devel protobuf
Run Code Online (Sandbox Code Playgroud)
如果它告诉您“ protobuf-2.6.1已经安装”:1. brew uninstall --devel protobuf
2. brew link libtool
3。brew install --devel protobuf
正如另一位用户提到的,谷歌还有另一种官方方式。
在尝试之前请完整阅读。
步骤如下:
打开终端并输入以下内容
PROTOC_ZIP=protoc-3.7.1-osx-x86_64.zipcurl -OL https://github.com/google/protobuf/releases/download/v3.7.1/$PROTOC_ZIPsudo unzip -o $PROTOC_ZIP -d /usr/local bin/protocrm -f $PROTOC_ZIP为我工作。
PS
这仅适用于 osx 中的 3.7.1 版本。如果您想安装其他版本/平台,请访问版本链接并查看最新版本的详细信息,并使用这些信息。
参考
这个过程简化为
brew install protobuf
Run Code Online (Sandbox Code Playgroud)
它会安装最新版本的protobuf。对我来说,在撰写本文时,它已经安装了v3.7.1
| 归档时间: |
|
| 查看次数: |
126648 次 |
| 最近记录: |