Ubuntu install protoc
Author: s | 2025-04-24
Then, follow our steps to solve the code: Install protoc ubuntu. stackofcodes. Home Categories Popular Codes Articles /Shell/Bash/Install protoc ubuntu. Install protoc ubuntu. Install protoc Install or uninstall protoc-gen-go-grpc on Ubuntu 24.04 LTS (Noble Numbat) with our comprehensive guide. Install or uninstall protoc-gen-go-grpc on Ubuntu 24.04 LTS (Noble
Ubuntu (22.04)/protoc apt protoc
Ubuntu18.04にProtobuf(3.6.1)とgRPC(v1.18.0)の環境を構築します。ProtobufとgRPCのバージョン依存関係があります。開発環境では、最新のProtobuf(3.13.0)を使えないので、サポートしているProtobuf(3.6.1)を使用します。また、最新のgRPC(1.32.0)が古いProtobuf(3.6.1)でコンパイルできないので、Protobuf(3.6.1)を使用したgRPC(v1.18.0)を使用します。環境AsRock DeskMini GTX1060(Z370)Core i9-9900 (3.10GHz 8core 16thread)メモリー32GBNVIDIA GeForce GTX 1060 Mobile(6GB GDDR5)Ubuntu 18.04.5ROS MelodicQt Creator 4.9.2cmake-3.17.0protobuf 3.6.1gRPC v1.18.0参考:サービス間通信のための新技術「gRPC」入門protobufのインストールprotobufは、protobufのリポジトリとgRPCのthird_party/protobufフォルダからもインストールできます。aptのprotobuf 3.0.0のアンインストールapt-getで既にインストールした場合、アンインストールします。(apt-getのprotobufが3.0.0です)sudo apt-get remove protobuf-compilersudo apt-get remove libprotobuf-devsudo apt-get remove libprotobuf-lite10protobuf 3.6.1のインストールsudo apt-get install autoconf automake libtool curl make g++ unzipgit clone -b 3.6.x protobufgit submodule update --init --recursive./autogen.sh./configuremakemake checksudo make installsudo ldconfig # refresh shared library cache.protobufのバージョン確認$ protoc --versionlibprotoc 3.6.1$ which protoc /usr/local/bin/protocgRPCのインストール$HOME/.localにインストールします。MY_INSTALL_DIRの設定$ export MY_INSTALL_DIR=$HOME/.local$ mkdir -p $MY_INSTALL_DIR$ export PATH="$PATH:$MY_INSTALL_DIR/bin"PATHを~/.bashrcにも追加export PATH=$PATH:$HOME/.local/bincmakeのインストール$ sudo apt-get install cmake$ cmake --versioncmake version 3.10.2Version 3.13以降のcmakeが必要なので、新しいcmakeをインストールします。$ wget -q -O cmake-linux.sh sh cmake-linux.sh -- --skip-license --prefix=$MY_INSTALL_DIR$ rm cmake-linux.shPre-requisitesのインストール$ sudo apt-get install build-essential autoconf libtool pkg-config libssl-devrepositoryの取得$ git clone --recurse-submodules -b v1.18.0 cd grpcInstall c-arescd third_party/cares/caresgit fetch origingit checkout cares-1_13_0mkdir -p cmake/buildcd cmake/buildcmake -DCMAKE_BUILD_TYPE=Release ../..sudo make -j4 installrm -rf third_party/cares/cares # wipe out to prevent influencing the grpc buildInstall zlibcd third_party/zlibmkdir -p cmake/buildcd cmake/buildcmake -DCMAKE_BUILD_TYPE=Release ../..sudo make -j4 installrm -rf third_party/zlib # wipe out to prevent influencing the grpc buildInstall protobufprotobufのリポジトリから既にインストールした場合、不要です。third_party/protobufから再度インストールしても問題ないです。cd third_party/protobufmkdir -p cmake/buildcd cmake/buildcmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..sudo make -j4 installrm -rf third_party/protobuf # wipe out to prevent influencing the grpc buildInstall gRPC (package mode)cd grpcmkdir -p cmake/buildcd cmake/buildcmake \ -DCMAKE_BUILD_TYPE=Release \ -DgRPC_INSTALL=ON \ -DgRPC_BUILD_TESTS=OFF \ -DgRPC_CARES_PROVIDER=package \ -DgRPC_PROTOBUF_PROVIDER=package \ -DgRPC_SSL_PROVIDER=package \ -DgRPC_ZLIB_PROVIDER=package \ -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR \ ../..make -j4 install$ protoc --versionlibprotoc 3.6.1$ which protoc /usr/local/bin/protocgRPC example の実行Build the example$ cd examples/cpp/helloworld$ mkdir -p cmake/build$ cd cmake/build$ cmake ../..$ make -jRun the example$ ./greeter_server# From a different terminal$ ./greeter_clientGreeter received: Hello worldprotoファイルからgrpcとprotobufのC++コードの生成$ protoc \ --grpc_out=./codegen \ --cpp_out=./codegen \ --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` \ ./telemetry.proto$ cd codegen$ lstelemetry.grpc.pb.cc telemetry.grpc.pb.h telemetry.pb.cc telemetry.pb.h. Then, follow our steps to solve the code: Install protoc ubuntu. stackofcodes. Home Categories Popular Codes Articles /Shell/Bash/Install protoc ubuntu. Install protoc ubuntu. Install protoc Install or uninstall protoc-gen-go-grpc on Ubuntu 24.04 LTS (Noble Numbat) with our comprehensive guide. Install or uninstall protoc-gen-go-grpc on Ubuntu 24.04 LTS (Noble How can I install and execute protoc on this system? jupyter-notebook; protoc; Share. Improve this question. Follow Installing instructions for ubuntu, they're slightly Install PROTOC compiler. Mac: brew install protobuf. Ubuntu : sudo apt install protobuf-compiler. Check if it works $ protoc -version libprotoc 3.17.1. Let’s compile person.proto. In this tutorial we learn how to install protoc-gen-yarpc on Ubuntu 22.04. What is protoc-gen-yarpc. protoc-gen-yarpc is: yarpc is Yet Another RPC package for Go. This package contails In this tutorial we learn how to install protoc-gen-yarpc on Ubuntu 20.04. What is protoc-gen-yarpc. protoc-gen-yarpc is: yarpc is Yet Another RPC package for Go. This package contails Install protoc-c command on any operating system and in Docker. command-not-found.com. Ubuntu apt-get install protobuf-c-compiler. This package contains the protoc-c code Protocol Buffers - Google's data interchange formatCopyright 2008 Google Inc. Buffers (a.k.a., protobuf) are Google's language-neutral,platform-neutral, extensible mechanism for serializing structured data. Youcan find protobuf's documentation on the Google Developers site.This README file contains protobuf installation instructions. To installprotobuf, you need to install the protocol compiler (used to compile .protofiles) and the protobuf runtime for your chosen programming language.Protocol Compiler InstallationThe protocol compiler is written in C++. If you are using C++, please followthe C++ Installation Instructions to install protoc alongwith the C++ runtime.For non-C++ users, the simplest way to install the protocol compiler is todownload a pre-built binary from our release page: the downloads section of each release, you can find pre-built binaries inzip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binaryas 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 releasepage, check out the maven repo here: pre-built binaries are only provided for released versions. If you wantto use the github main version at HEAD, or you need to modify protobuf code,or you are using C++, it's recommended to build your own protoc binary fromsource.If you would like to build protoc binary from source, see the C++ InstallationInstructions.Protobuf Runtime InstallationProtobuf supports several different programming languages. For each programminglanguage, you can find instructions in the corresponding source directory abouthow to install protobuf runtime for that specific language:LanguageSourceC++ (include C++ runtime and protoc)srcJavajavaPythonpythonObjective-CobjectivecC#csharpRubyrubyGoprotocolbuffers/protobuf-goPHPphpDartdart-lang/protobufQuick StartThe best way to learn how to use protobuf is to follow the tutorials in ourdeveloper guide: you want to learn from code examples, take a look at the examples in theexamples directory.DocumentationThe complete documentation for Protocol Buffers is available via theweb at:Comments
Ubuntu18.04にProtobuf(3.6.1)とgRPC(v1.18.0)の環境を構築します。ProtobufとgRPCのバージョン依存関係があります。開発環境では、最新のProtobuf(3.13.0)を使えないので、サポートしているProtobuf(3.6.1)を使用します。また、最新のgRPC(1.32.0)が古いProtobuf(3.6.1)でコンパイルできないので、Protobuf(3.6.1)を使用したgRPC(v1.18.0)を使用します。環境AsRock DeskMini GTX1060(Z370)Core i9-9900 (3.10GHz 8core 16thread)メモリー32GBNVIDIA GeForce GTX 1060 Mobile(6GB GDDR5)Ubuntu 18.04.5ROS MelodicQt Creator 4.9.2cmake-3.17.0protobuf 3.6.1gRPC v1.18.0参考:サービス間通信のための新技術「gRPC」入門protobufのインストールprotobufは、protobufのリポジトリとgRPCのthird_party/protobufフォルダからもインストールできます。aptのprotobuf 3.0.0のアンインストールapt-getで既にインストールした場合、アンインストールします。(apt-getのprotobufが3.0.0です)sudo apt-get remove protobuf-compilersudo apt-get remove libprotobuf-devsudo apt-get remove libprotobuf-lite10protobuf 3.6.1のインストールsudo apt-get install autoconf automake libtool curl make g++ unzipgit clone -b 3.6.x protobufgit submodule update --init --recursive./autogen.sh./configuremakemake checksudo make installsudo ldconfig # refresh shared library cache.protobufのバージョン確認$ protoc --versionlibprotoc 3.6.1$ which protoc /usr/local/bin/protocgRPCのインストール$HOME/.localにインストールします。MY_INSTALL_DIRの設定$ export MY_INSTALL_DIR=$HOME/.local$ mkdir -p $MY_INSTALL_DIR$ export PATH="$PATH:$MY_INSTALL_DIR/bin"PATHを~/.bashrcにも追加export PATH=$PATH:$HOME/.local/bincmakeのインストール$ sudo apt-get install cmake$ cmake --versioncmake version 3.10.2Version 3.13以降のcmakeが必要なので、新しいcmakeをインストールします。$ wget -q -O cmake-linux.sh sh cmake-linux.sh -- --skip-license --prefix=$MY_INSTALL_DIR$ rm cmake-linux.shPre-requisitesのインストール$ sudo apt-get install build-essential autoconf libtool pkg-config libssl-devrepositoryの取得$ git clone --recurse-submodules -b v1.18.0 cd grpcInstall c-arescd third_party/cares/caresgit fetch origingit checkout cares-1_13_0mkdir -p cmake/buildcd cmake/buildcmake -DCMAKE_BUILD_TYPE=Release ../..sudo make -j4 installrm -rf third_party/cares/cares # wipe out to prevent influencing the grpc buildInstall zlibcd third_party/zlibmkdir -p cmake/buildcd cmake/buildcmake -DCMAKE_BUILD_TYPE=Release ../..sudo make -j4 installrm -rf third_party/zlib # wipe out to prevent influencing the grpc buildInstall protobufprotobufのリポジトリから既にインストールした場合、不要です。third_party/protobufから再度インストールしても問題ないです。cd third_party/protobufmkdir -p cmake/buildcd cmake/buildcmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release ..sudo make -j4 installrm -rf third_party/protobuf # wipe out to prevent influencing the grpc buildInstall gRPC (package mode)cd grpcmkdir -p cmake/buildcd cmake/buildcmake \ -DCMAKE_BUILD_TYPE=Release \ -DgRPC_INSTALL=ON \ -DgRPC_BUILD_TESTS=OFF \ -DgRPC_CARES_PROVIDER=package \ -DgRPC_PROTOBUF_PROVIDER=package \ -DgRPC_SSL_PROVIDER=package \ -DgRPC_ZLIB_PROVIDER=package \ -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR \ ../..make -j4 install$ protoc --versionlibprotoc 3.6.1$ which protoc /usr/local/bin/protocgRPC example の実行Build the example$ cd examples/cpp/helloworld$ mkdir -p cmake/build$ cd cmake/build$ cmake ../..$ make -jRun the example$ ./greeter_server# From a different terminal$ ./greeter_clientGreeter received: Hello worldprotoファイルからgrpcとprotobufのC++コードの生成$ protoc \ --grpc_out=./codegen \ --cpp_out=./codegen \ --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` \ ./telemetry.proto$ cd codegen$ lstelemetry.grpc.pb.cc telemetry.grpc.pb.h telemetry.pb.cc telemetry.pb.h
2025-03-30Protocol Buffers - Google's data interchange formatCopyright 2008 Google Inc. Buffers (a.k.a., protobuf) are Google's language-neutral,platform-neutral, extensible mechanism for serializing structured data. Youcan find protobuf's documentation on the Google Developers site.This README file contains protobuf installation instructions. To installprotobuf, you need to install the protocol compiler (used to compile .protofiles) and the protobuf runtime for your chosen programming language.Protocol Compiler InstallationThe protocol compiler is written in C++. If you are using C++, please followthe C++ Installation Instructions to install protoc alongwith the C++ runtime.For non-C++ users, the simplest way to install the protocol compiler is todownload a pre-built binary from our release page: the downloads section of each release, you can find pre-built binaries inzip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binaryas 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 releasepage, check out the maven repo here: pre-built binaries are only provided for released versions. If you wantto use the github main version at HEAD, or you need to modify protobuf code,or you are using C++, it's recommended to build your own protoc binary fromsource.If you would like to build protoc binary from source, see the C++ InstallationInstructions.Protobuf Runtime InstallationProtobuf supports several different programming languages. For each programminglanguage, you can find instructions in the corresponding source directory abouthow to install protobuf runtime for that specific language:LanguageSourceC++ (include C++ runtime and protoc)srcJavajavaPythonpythonObjective-CobjectivecC#csharpRubyrubyGoprotocolbuffers/protobuf-goPHPphpDartdart-lang/protobufQuick StartThe best way to learn how to use protobuf is to follow the tutorials in ourdeveloper guide: you want to learn from code examples, take a look at the examples in theexamples directory.DocumentationThe complete documentation for Protocol Buffers is available via theweb at:
2025-04-15Protoc-jar-maven-pluginProtocol Buffers protobuf maven plugin - performs protobuf code generation using protoc-jar multi-platform executable protoc JAR.Available on Maven Central: maven plugin to compile .proto files using protoc-jar embedded protoc compiler, providing some portability across the major platforms (Linux, Mac/OSX, and Windows). At build time the plugin detects the platform and executes the corresponding protoc binary.Supports embedded protoc versions 2.4.1, 2.5.0, 2.6.1, 3.11.4, and any binaries (protoc and protoc plugins) available for download from maven central. Also supports pre-installed protoc binarySupport for FreeBSD on x86 platform (freebsd-x86_64), thanks kjopekSupport for Solaris on x86 platform (sunos-x86_64), thanks siepkesSupport for Linux on POWER8 platform (linux-ppcle_64), now from GoogleOlder versions (up to 3.6.0), thanks to Apache SystemML folks (nakul02)Support for Linux on ARM platform (linux-aarch_64), now from GoogleOlder versions (2.4.1, 2.6.1, 3.4.0), thanks garciagorkaSee also see in particular run-mojoSample usage - compile in main cycle into target/generated-sources, add generated sources to project, use default protoc version and default src/main/protobuf source folder: com.github.os72 protoc-jar-maven-plugin 3.11.4 generate-sources run ">plugin> groupId>com.github.os72groupId> artifactId>protoc-jar-maven-pluginartifactId> version>3.11.4version> executions> execution> phase>generate-sourcesphase> goals> goal>rungoal> goals> execution> executions>plugin>Sample usage - compile in main cycle into target/generated-sources, add generated sources to project, add all .proto sources to generated jar, include .proto files from direct maven dependencies, include additional imports: com.github.os72 protoc-jar-maven-plugin 3.11.4 generate-sources run all direct src/main/more_proto_imports src/main/protobuf ">plugin> groupId>com.github.os72groupId> artifactId>protoc-jar-maven-pluginartifactId> version>3.11.4version> executions> execution> phase>generate-sourcesphase> goals> goal>rungoal> goals> configuration> addProtoSources>alladdProtoSources> includeMavenTypes>directincludeMavenTypes> includeDirectories> include>src/main/more_proto_importsinclude> includeDirectories> inputDirectories> include>src/main/protobufinclude> inputDirectories> configuration> execution> executions>plugin>Sample usage - download protoc and plugin binaries from maven repo, multiple output targets (example: gRPC): com.github.os72 protoc-jar-maven-plugin 3.11.4 generate-sources run com.google.protobuf:protoc:3.0.0 src/main/resources java grpc-java io.grpc:protoc-gen-grpc-java:1.0.1 ">plugin> groupId>com.github.os72groupId> artifactId>protoc-jar-maven-pluginartifactId> version>3.11.4version> executions> execution> phase>generate-sourcesphase> goals> goal>rungoal> goals> configuration> protocArtifact>com.google.protobuf:protoc:3.0.0protocArtifact> inputDirectories> include>src/main/resourcesinclude> inputDirectories> outputTargets> outputTarget> type>javatype> outputTarget> outputTarget> type>grpc-javatype> pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.1pluginArtifact> outputTarget> outputTargets> configuration> execution> executions>plugin>Sample usage - javalite, multiple output targets: com.github.os72 protoc-jar-maven-plugin 3.11.4 generate-sources run src/main/resources java
2025-04-02Version numbers without dot seperators.Use PB.protocExecutable to use a locally installed protoc. By defaultthis key downloads and caches protoc from Maven.If you previously used protoc-jar's option --include_std_types, seeInstallation instructions above, and look for "To make standard google.protobuf types available to import"Use PB.protocRun to have more control on how sbt-protoc invokes protoc (Bydefault, it run PB.protocExecutable.See CHANGELOG.md for more details.Additional optionsThe options below need to be scoped to either Compile or Test (if unsure,you probably want Compile)Example settings: file("/some/other/dir"))// Use a locally provided protoc (in 1.x):PB.protocExecutable := file("/path/to/protoc")// For sbt-protoc Process("/path/to/protoc", args)!)// Prevents the plugin from adding libraryDependencies to your projectPB.additionalDependencies := Nil// Before version 0.99.15, when compiling in Windows, Python was used to bridge// protoc and this JVM. To set the path for Python.exe:// Note that this must be Python2 and not Python3.// Since version 0.99.15 this option has no effect, and will be removed in a// future version.PB.pythonExe := "/path/to/python.exe"// Disables the manifest processing feature of sbt-protoc that automatically// adds option protos as a source file to protoc when `ScalaPB-Options-Proto`// is found in a dependency jar manifest. This setting is turned on by default,// and disabling it can lead to generation of code that does not compile due// to inconsistent generator settings between your project and the dependencies// added. See also / PB.manifestProcessing := false">// Force the version for the protoc binaryPB.protocVersion := "3.21.7"// Additional directories to search for imports:Compile / PB.includePaths ++= Seq(file("/some/other/path"))// Make protos from some Jar available to import.libraryDependencies ++= Seq( "com.google.protobuf" % "protobuf-java" % "3.13.0" % "protobuf")// Compile protos from some Jar (and make them available to import). Without// the intrasitive() directory, `protobuf-src` would also unpack and compile// all transitive dependencies of the package. This could lead to having// duplicate class files, if another library is already providing compiled// classes for your dependencies.libraryDependencies ++= Seq( "com.google.api.grpc" % "proto-google-common-protos" % "1.17.0" % "protobuf-src" intransitive())// Changing where to look for protos to compile (default src/main/protobuf):Compile / PB.protoSources := Seq(sourceDirectory.value / "somewhere")// Additional options to pass to protoc:Compile / PB.protocOptions := Seq("-xyz")// Excluding some proto files:PB.generate / excludeFilter := "test-*.proto"// Rarely needed: override where proto files from library dependencies are// extracted to:Compile / PB.externalIncludePath := file("/tmp/foo")// By default we generate into target/src_managed. To customize:Compile / PB.targets := Seq( scalapb.gen() -> file("/some/other/dir"))// Use a locally provided protoc (in 1.x):PB.protocExecutable := file("/path/to/protoc")// For sbt-protoc Compile / PB.runProtoc := (args => Process("/path/to/protoc", args)!)// Prevents the plugin from adding libraryDependencies to your projectPB.additionalDependencies := Nil// Before version 0.99.15, when compiling in Windows, Python was used to bridge// protoc and this JVM. To set the path for Python.exe:// Note that this must be Python2 and not Python3.// Since version 0.99.15 this option has no effect, and will be removed in a// future version.PB.pythonExe := "/path/to/python.exe"// Disables the manifest processing feature of sbt-protoc that automatically// adds option protos as a source file to protoc when `ScalaPB-Options-Proto`// is found in a dependency jar manifest. This setting is turned on by default,// and disabling it can lead to generation of code that does not compile due//
2025-04-02