Skip to content

Commit

Permalink
Merge branch 'update-protoc'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Sep 29, 2023
2 parents 46fb1e5 + 3c55ad6 commit 4065b91
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion BuildInstructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on your platform please submit an issue or a pull request.
instructions](https://golang.org/doc/install). Newer versions may work
too.

- Install a protobuf compiler (version 3 and up), it can be installed on most major Linux distros
- Install a protobuf compiler (version 3.15 and up), it can be installed on most major Linux distros
via the package name `protobuf-compiler`, `protobuf` on macOS via Homebrew, and on Windows
binaries are available on their GitHub [page](https://github.com/protocolbuffers/protobuf/releases)
and they have to be put in `%PATH`. An additional package might also be required depending on
Expand Down
19 changes: 18 additions & 1 deletion building/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ ARG GOLANG_VERSION=1.18.5 \
# The pinned commit has this solved: https://github.com/rui314/mold/issues/1003.
ARG MOLD_COMMIT_REF=c4722fe5aed96295837d9150b20ef8698c7a28db

# Pinned to commit hash for tag v4.24.3
ARG PROTOBUF_COMMIT_REF=ee1355459c9ce7ffe264bc40cfdc7b7623d37e99

# === Install/set up the image ===

RUN dpkg --add-architecture arm64 && apt-get update -y && apt-get install -y \
Expand All @@ -42,7 +45,6 @@ RUN dpkg --add-architecture arm64 && apt-get update -y && apt-get install -y \
gcc gcc-aarch64-linux-gnu \
libdbus-1-dev libdbus-1-dev:arm64 \
rpm \
protobuf-compiler \
# For cross-compiling/linting towards Windows
gcc-mingw-w64-x86-64 \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -68,6 +70,21 @@ ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="aarch64-linux-gnu-gcc" \
# https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html#cargos-sparse-protocol
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

# === protobuf (for compiling .proto files) ===

RUN apt-get update -y && \
apt-get install -y --mark-auto cmake g++ && \
rm -rf /var/lib/apt/lists/* && \
git clone https://github.com/protocolbuffers/protobuf.git && \
cd protobuf && \
git reset --hard "$PROTOBUF_COMMIT_REF" && \
git submodule update --init --recursive && \
cmake . -DCMAKE_CXX_STANDARD=14 && \
cmake --build . -j $(nproc) && \
cmake --install . && \
cd .. && rm -rf protobuf && \
apt-get autoremove -y

# === mold (fast linker) ===
# Allows linking Rust binaries significantly faster.

Expand Down

0 comments on commit 4065b91

Please sign in to comment.