Linux 中的谷歌 protobuf

发布于 2024-08-24 23:46:58 字数 919 浏览 4 评论 0原文

我正在使用 protobuf 和 Linux。它的编译器protoc在哪里?我已经从主站点下载了该软件包,并成功编译并安装了它,但我找不到 protoc 来构建我自己的格式文件。它在哪里?

更新 这是我构建 protobuf 的文件夹:

aclocal.m4        depcomp                       Makefile.in
autogen.sh        editors                       missing
CHANGES.txt       examples                      protobuf-lite.pc
config.guess      generate_descriptor_proto.sh  protobuf-lite.pc.in
config.h          gtest                         protobuf.pc
config.h.in       install-sh                    protobuf.pc.in
config.log        INSTALL.txt                   python
config.status     java                          README.txt
config.sub        libtool                       src
configure         ltmain.sh                     stamp-h1
configure.ac      m4                            vsprojects
CONTRIBUTORS.txt  Makefile
COPYING.txt       Makefile.am

没有我需要的二进制文件。

I'm working with protobuf and Linux. Where is its compiler protoc? I've downloaded the package from the main site, compiled and installed it successfully but I can't find protoc to build my own format file. Where is it?

UPDATE
Here is folder where I built protobuf:

aclocal.m4        depcomp                       Makefile.in
autogen.sh        editors                       missing
CHANGES.txt       examples                      protobuf-lite.pc
config.guess      generate_descriptor_proto.sh  protobuf-lite.pc.in
config.h          gtest                         protobuf.pc
config.h.in       install-sh                    protobuf.pc.in
config.log        INSTALL.txt                   python
config.status     java                          README.txt
config.sub        libtool                       src
configure         ltmain.sh                     stamp-h1
configure.ac      m4                            vsprojects
CONTRIBUTORS.txt  Makefile
COPYING.txt       Makefile.am

There isn't a binary file I need.

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

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

发布评论

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

评论(5

甚是思念 2024-08-31 23:46:58

它可能安装在 /usr/local/bin 中,

至少在 Ubuntu 上,您可以使用 apt-get install protobuf-compiler 来代替。

从 INSTALL.txt 中:

安装名称

默认情况下,“make install”将安装包的文件
'/usr/local/bin', '/usr/local/man' 等。您可以指定一个
通过提供“configure”来设置除“/usr/local”之外的安装前缀
选项“--prefix=PATH”。

It's probably installed into /usr/local/bin

On Ubuntu at least, you can apt-get install protobuf-compiler instead.

From the INSTALL.txt:

Installation Names

By default, 'make install' will install the package's files in
'/usr/local/bin', '/usr/local/man', etc. You can specify an
installation prefix other than '/usr/local' by giving 'configure' the
option '--prefix=PATH'.

本宫微胖 2024-08-31 23:46:58

首先,您需要从 protobuff(在根文件夹中)编译源代码:

./configure  
make   
make check   
make install

第二:

echo "/usr/local/lib">>/etc/ld.so.conf  
echo "/usr/lib">>/etc/ld.so.conf    
ldconfig

第三:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

阅读根文件夹中的 README.txt 以获取更多信息。

First, you need to compile you source code from protobuff (in the root folder):

./configure  
make   
make check   
make install

Second:

echo "/usr/local/lib">>/etc/ld.so.conf  
echo "/usr/lib">>/etc/ld.so.conf    
ldconfig

Third:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Read README.txt in root folder for more info.

九公里浅绿 2024-08-31 23:46:58

另外,如果您实际上使用的是 Ubuntu,那么如果您想要比上次截止时间(对于 Ubuntu 9.10 来说是去年夏末的某个时间)更新的软件包,您还可以从 Debian stable 获取源软件包并在本地重建它们。这样,您最终会得到 .deb 软件包,并保留正常的升级路径(而不是在 /usr/local 中乱扔一次性安装)。

Also, if you are in fact on Ubuntu, then you can also fetch the source package from Debian unstable and rebuild them locally if you want packages that are more current than the last cutoff (which for Ubuntu 9.10 was some time late last summer). That way you end up with .deb packages and you preserve a normal upgrade path (rather than littering /usr/local with one-off installs).

望笑 2024-08-31 23:46:58

您可以在您设置的路径中找到protoc ./configure --prefix=you_path。
当你 make install 成功后,它会在该路径中包含 bin、include 和 lib。

You can find protoc in the path which you set ./configure --prefix=you_path.
When you make install successful, it will general bin, include and lib in that path.

蓝眼睛不忧郁 2024-08-31 23:46:58

事实上你不需要知道它的位置。
您所需要做的就是打开原始文件所在的终端并在终端上写入,

protoc -I=. --cpp_out=. filename.proto

请按照此链接获取文档

Actually you don't need to know it's place.
All you want is to open terminal where your proto file is located and write at terminal

protoc -I=. --cpp_out=. filename.proto

follow this link for documentation

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