From 28cfd46cadcfe456be925e4a954d84ce5616dadc Mon Sep 17 00:00:00 2001 From: Sonic Build Admin Date: Sat, 2 Aug 2025 01:32:31 +0000 Subject: [PATCH] Add rust to bullseye. #### Why I did it Rust was added to bookworm, but is missing in bullseye build. Sonic-swss-common needs rust to build after https://github.com/sonic-net/sonic-swss-common/pull/1044, and bullseye build failures were seen due to missing rust when building Pensando DPU image with: make init make configure PLATFORM=pensando PLATFORM_ARCH=arm64 NOJESSIE=1 NOSTRETCH=1 NOBUSTER=0 NOBULLSEYE=0 make target/sonic-pensando.tar ##### Work item tracking - Microsoft ADO **(number only)**: #### How I did it Add rust to bullseye dockerfile similarly to bookworm. #### How to verify it Successfully built Pensando image with: make init make configure PLATFORM=pensando PLATFORM_ARCH=arm64 NOJESSIE=1 NOSTRETCH=1 NOBUSTER=0 NOBULLSEYE=0 make target/sonic-pensando.tar #### Which release branch to backport (provide reason below if selected) - [ ] 202205 - [ ] 202211 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 - [ ] 202505 #### Tested branch (Please provide the tested image version) - [ ] - [ ] #### Description for the changelog #### Link to config_db schema for YANG module changes #### A picture of a cute animal (not mandatory but encouraged) --- sonic-slave-bullseye/Dockerfile.j2 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sonic-slave-bullseye/Dockerfile.j2 b/sonic-slave-bullseye/Dockerfile.j2 index 1c99597359..fbccaf29cf 100644 --- a/sonic-slave-bullseye/Dockerfile.j2 +++ b/sonic-slave-bullseye/Dockerfile.j2 @@ -704,3 +704,15 @@ RUN curl -fsSL -o /usr/local/bin/bazel ${bazelisk_url} && chmod 755 /usr/local/b # TODO(PINS): remove when Bazel is okay with "python3" binary name RUN eatmydata apt install -y python-is-python3 {% endif -%} + +# Install Rust +ARG RUST_ROOT=/usr/.cargo +RUN RUSTUP_HOME=$RUST_ROOT CARGO_HOME=$RUST_ROOT bash -c 'curl --proto "=https" -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.86.0 -y' +{% if CROSS_BUILD_ENVIRON == "y" and CONFIGURED_ARCH == "armhf" %} +RUN mkdir -p /.cargo && $RUST_ROOT/bin/rustup target add armv7-unknown-linux-gnueabihf && echo "[target.armv7-unknown-linux-gnueabihf]\nlinker = \"arm-linux-gnueabihf-gcc\"" >> /.cargo/config.toml +{% endif -%} +{% if CROSS_BUILD_ENVIRON == "y" and CONFIGURED_ARCH == "arm64" %} +RUN mkdir -p /.cargo && $RUST_ROOT/bin/rustup target add aarch64-unknown-linux-gnu && echo "[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> /.cargo/config.toml +{% endif -%} +ENV RUSTUP_HOME $RUST_ROOT +ENV PATH $PATH:$RUST_ROOT/bin