-
-
Save bernardoaraujor/27dceddbece1c1b73d90e7ddeb3af7e3 to your computer and use it in GitHub Desktop.
Polkadot Raspberry PI (64 bit) cross-compile build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Run this file from the root of substrate / polkadot directory. | |
DOCKER_IMAGE="polkadot/rpi" | |
docker build -t $DOCKER_IMAGE . | |
docker run --rm -it \ | |
--env BINDGEN_EXTRA_CLANG_ARGS="--sysroot=/usr/aarch64-unknown-linux-gnu -D__ARM_PCS_VFP -mfpu=vfp -mfloat-abi=hard" \ | |
--env CARGO_HOME=/home/rust/src/cargo_home \ | |
-v "$(pwd)":/home/rust/src polkadot/rpi \ | |
cargo +nightly build -Z features=itarget --target=aarch64-unknown-linux-gnu --release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this file in the root of substrate / polkadot directory. | |
FROM rust:latest | |
RUN dpkg --add-architecture arm64 && \ | |
apt-get update && apt-get upgrade -y && \ | |
apt-get install -y aptitude && \ | |
aptitude install -y \ | |
gcc-aarch64-linux-gnu \ | |
g++-aarch64-linux-gnu \ | |
pkg-config \ | |
cmake \ | |
libssl-dev \ | |
git \ | |
clang \ | |
libclang-dev \ | |
libz-dev:arm64 \ | |
libssl-dev:arm64 | |
RUN rustup install nightly | |
RUN rustup target add aarch64-unknown-linux-gnu --toolchain nightly | |
RUN rustup target add wasm32-unknown-unknown --toolchain nightly | |
RUN cargo +nightly install --git https://github.com/alexcrichton/wasm-gc --force | |
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | |
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="/linux-runner aarch64" | |
ENV CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc | |
ENV CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ | |
ENV PKG_CONFIG_ALLOW_CROSS 1 | |
ENV PKG_CONFIG_PATH /usr/lib/aarch64-unknown-linux-gnu/pkgconfig/ | |
RUN useradd rust --user-group --create-home --shell /bin/bash --groups sudo | |
WORKDIR /home/rust/src |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment