Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust to 1.59.0 #307

Merged
merged 4 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
# All checks on the codebase that can run in parallel to build_shared_library
libwasmvm_sanity:
docker:
- image: cimg/rust:1.55.0
- image: cimg/rust:1.59.0
steps:
- checkout
- run:
Expand All @@ -15,7 +15,7 @@ jobs:
command: rustup component add clippy rustfmt
- restore_cache:
keys:
- cargocache-v3-libwasmvm_sanity-rust:1.55.0-{{ checksum "libwasmvm/Cargo.lock" }}
- cargocache-v3-libwasmvm_sanity-rust:1.59.0-{{ checksum "libwasmvm/Cargo.lock" }}
- run:
name: Check Rust formatting
working_directory: libwasmvm
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
- libwasmvm/target/release/.fingerprint
- libwasmvm/target/release/build
- libwasmvm/target/release/deps
key: cargocache-v3-libwasmvm_sanity-rust:1.55.0-{{ checksum "libwasmvm/Cargo.lock" }}
key: cargocache-v3-libwasmvm_sanity-rust:1.59.0-{{ checksum "libwasmvm/Cargo.lock" }}

libwasmvm_audit:
docker:
Expand Down Expand Up @@ -134,15 +134,15 @@ jobs:

build_shared_library:
docker:
- image: cimg/rust:1.55.0
- image: cimg/rust:1.59.0
steps:
- checkout
- run:
name: Show version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-v3-build_shared_library-rust:1.55.0-{{ checksum "libwasmvm/Cargo.lock" }}
- cargocache-v3-build_shared_library-rust:1.59.0-{{ checksum "libwasmvm/Cargo.lock" }}
- run:
name: Create release build of libwasmvm
command: make build-rust
Expand All @@ -159,7 +159,7 @@ jobs:
- libwasmvm/target/release/.fingerprint
- libwasmvm/target/release/build
- libwasmvm/target/release/deps
key: cargocache-v3-build_shared_library-rust:1.55.0-{{ checksum "libwasmvm/Cargo.lock" }}
key: cargocache-v3-build_shared_library-rust:1.59.0-{{ checksum "libwasmvm/Cargo.lock" }}

test:
docker:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.PHONY: all build build-rust build-go test

# Builds the Rust library libwasmvm
BUILDERS_PREFIX := cosmwasm/go-ext-builder:0010
BUILDERS_PREFIX := cosmwasm/go-ext-builder:0011
# Contains a full Go dev environment in order to run Go tests on the built library
ALPINE_TESTER := cosmwasm/go-ext-builder:0010-alpine
ALPINE_TESTER := cosmwasm/go-ext-builder:0011-alpine

USER_ID := $(shell id -u)
USER_GROUP = $(shell id -g)
Expand Down Expand Up @@ -98,7 +98,7 @@ test-alpine: release-build-alpine
@# Build a Go demo binary called ./demo that links the static library from the previous step.
@# Whether the result is a statically linked or dynamically linked binary is decided by `go build`
@# and it's a bit unclear how this is decided. We use `file` to see what we got.
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) go build -tags muslc -o demo ./cmd
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) ./build_demo.sh
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/mnt/testrun -w /mnt/testrun $(ALPINE_TESTER) file ./demo

@# Run the demo binary on Alpine machines
Expand Down
14 changes: 14 additions & 0 deletions build_demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -e # Note we are not using bash here but the Alpine default shell

# This script is called in an Alpine container to build the demo binary in ./cmd/demo.
# We use a script to reduce the escaping hell when passing arguments to the linker.

# See "2. If you really need CGO, but not netcgo" in https://dubo-dubon-duponey.medium.com/a-beginners-guide-to-cross-compiling-static-cgo-pie-binaries-golang-1-16-792eea92d5aa
# See also https://github.com/rust-lang/rust/issues/78919 for why we need -Wl,-z,muldefs
go build -ldflags "-linkmode=external -extldflags '-Wl,-z,muldefs -static'" -tags muslc \
-o demo ./cmd/demo

# Or static-pie if you really want to
# go build -buildmode=pie -ldflags "-linkmode=external -extldflags '-Wl,-z,muldefs -static-pie'" -tags muslc \
# -o demo ./cmd/demo
2 changes: 1 addition & 1 deletion builders/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN set -eux \

RUN wget "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-musl/rustup-init" \
&& chmod +x rustup-init \
&& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.55.0 \
&& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.59.0 \
&& rm rustup-init \
&& chmod -R a+w $RUSTUP_HOME $CARGO_HOME

Expand Down
2 changes: 1 addition & 1 deletion builders/Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \

RUN wget "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" \
&& chmod +x rustup-init \
&& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.55.0 \
&& ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.59.0 \
&& rm rustup-init \
&& chmod -R a+w $RUSTUP_HOME $CARGO_HOME \
&& rustup --version \
Expand Down
2 changes: 1 addition & 1 deletion builders/Dockerfile.cross
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.55.0-bullseye
FROM rust:1.59.0-bullseye

# Install build dependencies
RUN apt-get update \
Expand Down
14 changes: 4 additions & 10 deletions builders/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Versioned by a simple counter that is not bound to a specific CosmWasm version
# See builders/README.md
BUILDERS_PREFIX := cosmwasm/go-ext-builder:0010
BUILDERS_PREFIX := cosmwasm/go-ext-builder:0011

.PHONY: docker-image-centos7
docker-image-centos7:
docker build . -t $(BUILDERS_PREFIX)-centos7 -f ./Dockerfile.centos7
docker build --pull . -t $(BUILDERS_PREFIX)-centos7 -f ./Dockerfile.centos7

.PHONY: docker-image-cross
docker-image-cross:
docker build . -t $(BUILDERS_PREFIX)-cross -f ./Dockerfile.cross
docker build --pull . -t $(BUILDERS_PREFIX)-cross -f ./Dockerfile.cross

.PHONY: docker-image-alpine
docker-image-alpine:
docker build . -t $(BUILDERS_PREFIX)-alpine -f ./Dockerfile.alpine
docker build --pull . -t $(BUILDERS_PREFIX)-alpine -f ./Dockerfile.alpine

.PHONY: docker-images
docker-images: docker-image-centos7 docker-image-cross docker-image-alpine
Expand All @@ -22,9 +22,3 @@ docker-publish: docker-images
docker push $(BUILDERS_PREFIX)-cross
docker push $(BUILDERS_PREFIX)-centos7
docker push $(BUILDERS_PREFIX)-alpine

.PHONY: pull-base-images
pull-base-images:
docker pull golang:1.17.7-alpine
docker pull centos:centos7
docker pull rust:1.55.0-bullseye
4 changes: 4 additions & 0 deletions builders/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ can do the cross-compilation.

## Changelog

**Version 0011:**

- Update Rust to 1.59.0.

**Version 0010:**

- Add cross-compilation setup to build `libwasmvm_muslc.a` and `libwasmvm_muslc.aarch64.a`
Expand Down
File renamed without changes.