<Bazel tree>/third_party/protobuf/<version>
<Bazel tree>/third_party/protobuf/<version>
chmod +x *.exe
The 64-bit Linux version of the proto compiler is linked statically. To update it, do the following steps on an x86_64 machine:
git clone http://github.com/google/protobuf.git
git checkout <tag or commithash>
(e.g. v3.0.0
or e8ae137
)./autogen.sh
LDFLAGS=-static ./configure
LDFLAGS = -static
to LDFLAGS = -all-static
in src/Makefile
.make
cp src/protoc <Bazel tree>/third_party/protobuf/<version>/protoc-<version>-linux-x86_64.exe
.Do this from a MinGW shell ([https://sourceforge.net/projects/msys2/files/]) on a Windows machine.
Clone the protobuf repo and check out the right commit
git clone http://github.com/google/protobuf.git git checkout <tag or commithash> # e.g. `v3.0.0` or `e8ae137`
Close all other MSYS/MinGW/Cygwin windows. Kill all running background jobs. This step is optional, but if you have other terminal windows open the next step may print some error messages (though it still seems to work).
Install necessary MinGW packages
pacman -Syuu autoconf automake libtool curl make gcc unzip
Configure for static linking and build like you would for Unix
./autogen.sh ./configure --disable-shared # takes about 2 minutes ./make # takes about 11 minutes
Copy resulting binary
cp src/protoc.exe <bazel tree>/third_party/protobuf/protoc-mingw.exe
To add 64-bit Linux s390x version of the statically linked proto compiler, use below steps:
cp src/protoc <Bazel tree>/third_party/protobuf/protoc-linux-s390x_64.exe
cp src/protoc <Bazel tree>/third_party/protobuf/<version>/protoc-linux-s390x_64.exe
protobuf.bzl
and the src/
directory:git clone http://github.com/google/protobuf.git
git checkout <tag or commithash>
(e.g. v3.0.0
or e8ae137
)mkdir -p third_party/protobuf/<version>/src/google
in the root of the Bazel tree.cp -R <root of protobuf tree>/src/google/protobuf third_party/protobuf/src/google
third_party/protobuf/BUILD
with the rules in the protobuf repository.Finally, update the rules:
third_party/protobuf/<version>/
. Use the BUILD file for the previous version as a template. Update the cc_library
rules to match the rules in the BUILD file in the protobuf repository. Also copy protobuf.bzl
from the protobuf repository into third_party/protobuf/<version>/
.third_party/protobuf/BUILD
to point to the new rules.Follow usual procedure as described on https://www.bazel.io/contributing.html