Protoc mac os install

Содержание
  1. Protocol Buffer Compiler Installation
  2. Protocol Buffer Compiler Installation
  3. Install using a package manager
  4. Warning
  5. Install pre-compiled binaries (any OS)
  6. Other installation options
  7. Protoc mac os install
  8. Protoc mac os install
  9. About
  10. rajkrrsingh / Google protobuf installation on Mac
  11. This comment has been minimized.
  12. okulkarni-weekendr commented Apr 9, 2018
  13. This comment has been minimized.
  14. Zhenye-Na commented Sep 16, 2018
  15. This comment has been minimized.
  16. yunfan123 commented Sep 27, 2018
  17. This comment has been minimized.
  18. Ragnyll commented Mar 5, 2019
  19. This comment has been minimized.
  20. akiasprin commented Mar 8, 2019
  21. This comment has been minimized.
  22. guoshuai commented Mar 30, 2019
  23. This comment has been minimized.
  24. sriki77 commented Jun 30, 2019
  25. This comment has been minimized.
  26. haiboself commented Sep 1, 2019
  27. This comment has been minimized.
  28. plainbanana commented Sep 10, 2019
  29. This comment has been minimized.
  30. snemuri commented Oct 15, 2019
  31. This comment has been minimized.
  32. djcvijic commented Nov 14, 2019
  33. This comment has been minimized.
  34. adigunhammedolalekan commented Nov 14, 2019
  35. This comment has been minimized.
  36. weina2018 commented Nov 23, 2019
  37. This comment has been minimized.
  38. weina2018 commented Nov 23, 2019
  39. This comment has been minimized.
  40. StanSun commented Dec 1, 2019
  41. This comment has been minimized.
  42. datng2 commented Dec 6, 2019
  43. This comment has been minimized.
  44. chaoman commented Feb 25, 2020
  45. This comment has been minimized.
  46. Stephan14 commented Mar 1, 2020
  47. This comment has been minimized.
  48. SamsonLai commented Mar 25, 2020
  49. This comment has been minimized.
  50. deximat commented Jun 1, 2020
  51. This comment has been minimized.
  52. bhupathiv commented Oct 19, 2020
  53. This comment has been minimized.
  54. ijulanday commented Nov 24, 2020
  55. This comment has been minimized.
  56. vineetgarg02 commented Feb 11, 2021
  57. This comment has been minimized.
  58. guanjinke commented Mar 16, 2021
  59. This comment has been minimized.
  60. april1989 commented Mar 18, 2021
  61. This comment has been minimized.
  62. tj-byun commented May 7, 2021
  63. This comment has been minimized.
  64. dzypersonal commented May 27, 2021
  65. This comment has been minimized.
  66. tianhong-1 commented Jul 27, 2021 •
  67. This comment has been minimized.
  68. tianhong-1 commented Jul 27, 2021
  69. This comment has been minimized.
  70. tianhong-1 commented Jul 27, 2021

Protocol Buffer Compiler Installation

How to install the protocol buffer compiler.

Protocol Buffer Compiler Installation

While not mandatory, gRPC applications often leverage Protocol Buffers for service definitions and data serialization. Most of the example code from this site uses version 3 of the protocol buffer language (proto3) .

The protocol buffer compiler, protoc , is used to compile .proto files, which contain service and message definitions. Choose one of the methods given below to install protoc .

Install using a package manager

You can install the protocol compiler, protoc , with a package manager under Linux or macOS using the following commands.

Warning

Check the version of protoc (as indicated below) after installation to ensure that it is sufficiently recent. The versions of protoc installed by some package managers can be quite dated.

Installing from pre-compiled binaries, as indicated in the next section, is the best way to ensure that you’re using the latest release of protoc .

Linux, using apt or apt-get , for example:

Install pre-compiled binaries (any OS)

To install the latest release of the protocol compiler from pre-compiled binaries, follow these instructions:

Manually download from github.com/google/protobuf/releases the zip file corresponding to your operating system and computer architecture ( protoc- — .zip ), or fetch the file using commands such as the following:

Unzip the file under $HOME/.local or a directory of your choice. For example:

Update your environment’s path variable to include the path to the protoc executable. For example:

Other installation options

If you’d like to build the protocol compiler from sources, or access older versions of the pre-compiled binaries, see Download Protocol Buffers .

Источник

Protoc mac os install

Copy raw contents

Protocol Buffers — Google’s data interchange format

Copyright 2008 Google Inc.

C++ Installation — Unix

To build protobuf from source, the following tools are needed:

Читайте также:  Php редактор для windows

On Ubuntu/Debian, you can install them with:

On other platforms, please use the corresponding package managing tool to install them before proceeding.

To get the source, download one of the release .tar.gz or .zip packages in the release page:

For example: if you only need C++, download protobuf-cpp-[VERSION].tar.gz ; if you need C++ and Java, download protobuf-java-[VERSION].tar.gz (every package contains C++ source already); if you need C++ and multiple other languages, download protobuf-all-[VERSION].tar.gz .

You can also get the source by «git clone» our git repository. Make sure you have also cloned the submodules and generated the configure script (skip this if you are using a release .tar.gz or .zip package):

To build and install the C++ Protocol Buffer runtime and the Protocol Buffer compiler (protoc) execute the following:

If «make check» fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk.

For advanced usage information on configure and make, please refer to the autoconf documentation:

Hint on install location

By default, the package will be installed to /usr/local. However, on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH. You can add it, but it may be easier to just install to /usr instead. To do this, invoke configure as follows:

If you already built the package with a different prefix, make sure to run «make clean» before building again.

Compiling dependent packages

To compile a package that uses Protocol Buffers, you need to pass various flags to your compiler and linker. As of version 2.2.0, Protocol Buffers integrates with pkg-config to manage this. If you have pkg-config installed, then you can invoke it to get a list of flags like so:

Note that packages written prior to the 2.2.0 release of Protocol Buffers may not yet integrate with pkg-config to get flags, and may not pass the correct set of flags to correctly link against libprotobuf. If the package in question uses autoconf, you can often fix the problem by invoking its configure script like:

This will force it to use the correct flags.

If you are writing an autoconf-based package that uses Protocol Buffers, you should probably use the PKG_CHECK_MODULES macro in your configure script like:

See the pkg-config man page for more info.

If you only want protobuf-lite, substitute «protobuf-lite» in place of «protobuf» in these examples.

Note for Mac users

For a Mac system, Unix tools are not available by default. You will first need to install Xcode from the Mac AppStore and then run the following command from a terminal:

To install Unix tools, you can install «port» following the instructions at https://www.macports.org . This will reside in /opt/local/bin/port for most Mac installations.

Then follow the Unix instructions above.

Note for cross-compiling

The makefiles normally invoke the protoc executable that they just built in order to build tests. When cross-compiling, the protoc executable may not be executable on the host machine. In this case, you must build a copy of protoc for the host machine first, then use the —with-protoc option to tell configure to use it instead. For example:

This will use the installed protoc (found in your $PATH) instead of trying to execute the one built during the build process. You can also use an executable that hasn’t been installed. For example, if you built the protobuf package for your host machine in ../host, you might do:

Either way, you must make sure that the protoc executable you use has the same version as the protobuf source code you are trying to use it with.

Note for Solaris users

Solaris 10 x86 has a bug that will make linking fail, complaining about libstdc++.la being invalid. We have included a work-around in this package. To use the work-around, run configure as follows:

See src/solaris/libstdc++.la for more info on this bug.

Note for HP C++ Tru64 users

To compile invoke configure as follows:

Читайте также:  Windows cmd open port

Also, you will need to use gmake instead of make.

Note for AIX users

Compile using the IBM xlC C++ compiler as follows:

Also, you will need to use GNU make ( gmake ) instead of AIX make .

C++ Installation — Windows

If you only need the protoc binary, you can download it from the release page:

In the downloads section, download the zip file protoc-$VERSION-win32.zip. It contains the protoc binary as well as public proto files of protobuf library.

Protobuf and its dependencies can be installed directly by using vcpkg :

If zlib support is desired, you’ll also need to install the zlib feature:

To build from source using Microsoft Visual C++, see cmake/README.md.

To build from source using Cygwin or MinGW, follow the Unix installation instructions, above.

Binary Compatibility Warning

Due to the nature of C++, it is unlikely that any two versions of the Protocol Buffers C++ runtime libraries will have compatible ABIs. That is, if you linked an executable against an older version of libprotobuf, it is unlikely to work with a newer version without re-compiling. This problem, when it occurs, will normally be detected immediately on startup of your app. Still, you may want to consider using static linkage. You can configure this package to install static libraries only using:

The complete documentation for Protocol Buffers is available via the web at:

Источник

Protoc mac os install

Protocol Buffers — Google’s data interchange format

Copyright 2008 Google Inc.

Protocol Buffers (a.k.a., protobuf) are Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data. You can find protobuf’s documentation on the Google Developers site.

This README file contains protobuf installation instructions. To install protobuf, you need to install the protocol compiler (used to compile .proto files) and the protobuf runtime for your chosen programming language.

Protocol Compiler Installation

The protocol compiler is written in C++. If you are using C++, please follow the C++ Installation Instructions to install protoc along with the C++ runtime.

For non-C++ users, the simplest way to install the protocol compiler is to download a pre-built binary from our release page:

In the downloads section of each release, you can find pre-built binaries in zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary as well as a set of standard .proto files distributed along with protobuf.

If you are looking for an old version that is not available in the release page, check out the maven repo here:

These pre-built binaries are only provided for released versions. If you want to use the github master version at HEAD, or you need to modify protobuf code, or you are using C++, it’s recommended to build your own protoc binary from source.

If you would like to build protoc binary from source, see the C++ Installation Instructions.

Protobuf Runtime Installation

Protobuf supports several different programming languages. For each programming language, you can find instructions in the corresponding source directory about how to install protobuf runtime for that specific language:

Language Source
C++ (include C++ runtime and protoc) src
Java java
Python python
Objective-C objectivec
C# csharp
JavaScript js
Ruby ruby
Go protocolbuffers/protobuf-go
PHP php
Dart dart-lang/protobuf

The best way to learn how to use protobuf is to follow the tutorials in our developer guide:

If you want to learn from code examples, take a look at the examples in the examples directory.

The complete documentation for Protocol Buffers is available via the web at:

About

Protocol Buffers — Google’s data interchange format

Источник

rajkrrsingh / Google protobuf installation on Mac

$wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
$tar xvf protobuf-2.5.0.tar.bz2
$cd protobuf-2.5.0
$./configure CC=clang CXX=clang++ CXXFLAGS=’-std=c++11 -stdlib=libc++ -O3 -g’ LDFLAGS=’-stdlib=libc++’ LIBS=»-lc++ -lc++abi»
$make -j 4
$sudo make install
$protoc —version

This comment has been minimized.

Copy link Quote reply

okulkarni-weekendr commented Apr 9, 2018

Thanks a lot.. saved 2 hours..

This comment has been minimized.

Copy link Quote reply

Zhenye-Na commented Sep 16, 2018

Thanks sooo much!

This comment has been minimized.

Copy link Quote reply

yunfan123 commented Sep 27, 2018

This comment has been minimized.

Copy link Quote reply

Ragnyll commented Mar 5, 2019

This comment has been minimized.

Copy link Quote reply

akiasprin commented Mar 8, 2019

try it: brew install protobuf@2.5 🙂

This comment has been minimized.

Copy link Quote reply

guoshuai commented Mar 30, 2019

It won’t work unfortunately because protobuf@2.5 formula has been deprecated.

This comment has been minimized.

Copy link Quote reply

sriki77 commented Jun 30, 2019

thank you very much. big time saver

This comment has been minimized.

Copy link Quote reply

haiboself commented Sep 1, 2019

This comment has been minimized.

Copy link Quote reply

plainbanana commented Sep 10, 2019

thanks. it still works at Mojave.

This comment has been minimized.

Copy link Quote reply

snemuri commented Oct 15, 2019

This comment has been minimized.

Copy link Quote reply

djcvijic commented Nov 14, 2019

This comment has been minimized.

Copy link Quote reply

adigunhammedolalekan commented Nov 14, 2019

Try brew install protobuf

This comment has been minimized.

Copy link Quote reply

weina2018 commented Nov 23, 2019

Hi there, anyone could help to have the new version of «https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2» as it appears too old to install protobuf on macOS now thank you in advance, Edina

This comment has been minimized.

Copy link Quote reply

weina2018 commented Nov 23, 2019

I tried brew install protobuf, then brew link —overwrite protobuf it works on Macos with protobuf /3.10.1

This comment has been minimized.

Copy link Quote reply

StanSun commented Dec 1, 2019

brew install protobuf

protoc —version
libprotoc 3.11.0

This comment has been minimized.

Copy link Quote reply

datng2 commented Dec 6, 2019

For those who running on Mac OS Mojave 10.14 ran into error while running this line:

The fix is to install macOS_SDK_headers_for_macOS

This comment has been minimized.

Copy link Quote reply

chaoman commented Feb 25, 2020

Thanks so much. Got it working.

This comment has been minimized.

Copy link Quote reply

Stephan14 commented Mar 1, 2020

This comment has been minimized.

Copy link Quote reply

SamsonLai commented Mar 25, 2020

It works on my Mac, Thanks a lot!

This comment has been minimized.

Copy link Quote reply

deximat commented Jun 1, 2020

This comment has been minimized.

Copy link Quote reply

bhupathiv commented Oct 19, 2020

It works perfectly on my Mac. Thanks you very much..

This comment has been minimized.

Copy link Quote reply

ijulanday commented Nov 24, 2020

Needed to install protobuf 3.13.0 with 3.14.0 currently installed on Catalina 10.15.7–worked perfectly!

This comment has been minimized.

Copy link Quote reply

vineetgarg02 commented Feb 11, 2021

Anyone got this working on Apple silicon?

This comment has been minimized.

Copy link Quote reply

guanjinke commented Mar 16, 2021

This comment has been minimized.

Copy link Quote reply

april1989 commented Mar 18, 2021

This comment has been minimized.

Copy link Quote reply

tj-byun commented May 7, 2021

This comment has been minimized.

Copy link Quote reply

dzypersonal commented May 27, 2021

Failed on mac big sur, exception like this:
./google/protobuf/stubs/atomicops_internals_macosx.h:158:43: error: unknown type name ‘Atomic64’; did you mean ‘Atomic32’?
Atomic64 increment) <
^

Atomic32
Does anyone have an idea?

This comment has been minimized.

Copy link Quote reply

tianhong-1 commented Jul 27, 2021 •

Anyone got this working on Apple silicon?

This comment has been minimized.

Copy link Quote reply

tianhong-1 commented Jul 27, 2021

Failed on mac big sur, exception like this:
./google/protobuf/stubs/atomicops_internals_macosx.h:158:43: error: unknown type name ‘Atomic64’; did you mean ‘Atomic32’?
Atomic64 increment) <
^

Atomic32
Does anyone have an idea?

This comment has been minimized.

Copy link Quote reply

tianhong-1 commented Jul 27, 2021

Failed on mac big sur, exception like this:
./google/protobuf/stubs/atomicops_internals_macosx.h:158:43: error: unknown type name ‘Atomic64’; did you mean ‘Atomic32’?
Atomic64 increment) <
^

Atomic32
Does anyone have an idea?

Источник

Читайте также:  Mac os logitech options daemon как удалить
Оцените статью