Skip to content

Commit

Permalink
fix: s390x for build-images/rust-bullseye-stable-1-s390x
Browse files Browse the repository at this point in the history
Updated code for s390x version of build-images/rust-bullseye-stable-1-s390x

Fixes: logdna#62

Update Jenkinsfile
  • Loading branch information
SivakaviKavitha committed Jun 13, 2023
1 parent 54c0bf6 commit 838c082
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 13 additions & 2 deletions rust/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG CROSS_COMPILER_TARGET_ARCH=x86_64
ARG CROSS_COMPILER_TARGET_ARCH=blank
ARG BASE_IMAGE=logdna/build-images/rust-buster-1-stable-base-${CROSS_COMPILER_TARGET_ARCH}

# Image that runs natively on the BUILDPLATFORM to produce cross compile
Expand Down Expand Up @@ -29,6 +29,8 @@ ENV CC_aarch64_unknown_linux_musl=clang
ENV CFLAGS_aarch64_unknown_linux_musl="-isystem /usr/include/aarch64-linux-musl"
ENV CC_x86_64_unknown_linux_musl=clang
ENV CFLAGS_x86_64_unknown_linux_musl="-isystem /usr/include/x86_64-linux-musl"
ENV CC_s390x_unknown_linux_musl=clang
ENV CFLAGS_s390x_unknown_linux_musl="-isystem /usr/include/s390x-linux-musl"

RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \
mkdir -p /out/tools /usr/local/bin/ && \
Expand Down Expand Up @@ -271,10 +273,13 @@ RUN mkdir -p /usr/local/rocksdb/${CROSS_COMPILER_TARGET_ARCH}-linux-musl/include
RUN printf "#!/usr/bin/env bash\nclang -fuse-ld=lld --target=aarch64-unknown-linux-musl \$@" > /usr/local/bin/aarch64-unknown-linux-musl-clang && \
chmod +x /usr/local/bin/aarch64-unknown-linux-musl-clang && \
printf "#!/usr/bin/env bash\nclang -fuse-ld=lld --target=x86_64-unknown-linux-musl \$@" > /usr/local/bin/x86_64-unknown-linux-musl-clang && \
chmod +x /usr/local/bin/x86_64-unknown-linux-musl-clang
chmod +x /usr/local/bin/x86_64-unknown-linux-musl-clang && \
printf "#!/usr/bin/env bash\nclang -fuse-ld=lld --target=s390x-unknown-linux-musl \$@" > /usr/local/bin/s390x-unknown-linux-musl-clang && \
chmod +x /usr/local/bin/s390x-unknown-linux-musl-clang

ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER="/usr/local/bin/aarch64-unknown-linux-musl-clang"
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER="/usr/local/bin/x86_64-unknown-linux-musl-clang"
ENV CARGO_TARGET_s390x_UNKNOWN_LINUX_MUSL_LINKER="/usr/local/bin/s390x-unknown-linux-musl-clang"

ENV XWIN_CACHE_DIR="${CARGO_HOME}/xwin"
ENV XWIN_TOOLKIT_BIN_PATH="/usr/local/bin"
Expand Down Expand Up @@ -303,6 +308,7 @@ ENV STATIC_RUSTFLAGS="${COMMON_RUSTFLAGS} -Ctarget-feature=+crt-static -Clink-ar

ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="${STATIC_RUSTFLAGS} -Clink-args=--target=aarch64-unknown-linux-musl"
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="${STATIC_RUSTFLAGS} -Clink-args=--target=x86_64-unknown-linux-musl"
ENV CARGO_TARGET_s390x_UNKNOWN_LINUX_MUSL_RUSTFLAGS="${STATIC_RUSTFLAGS} -Clink-args=--target=s390x-unknown-linux-musl"

ENV CC_aarch64_unknown_linux_musl="clang"
ENV CFLAGS_aarch64_unknown_linux_musl="--target=aarch64-unknown-linux-musl -fuse-ld=lld -static -fPIC -nostdlib -nodefaultlibs -nostdinc -isystem $LLVM_SYSROOT/usr/lib/clang/${LLVM_VERSION}/include/ -isystem $LLVM_SYSROOT/usr/aarch64-unknown-linux-musl/include/ -isystem $LLVM_SYSROOT/usr/include/linux/ -L ${LLVM_SYSROOT}/usr/aarch64-unknown-linux-musl/lib -lc -L ${LLVM_SYSROOT}/usr/lib/linux/ -lclang_rt.builtins-aarch64"
Expand All @@ -314,6 +320,11 @@ ENV CFLAGS_x86_64_unknown_linux_musl="--target=x86_64-unknown-linux-musl -fuse-l
ENV CXX_x86_64_unknown_linux_musl="clang++"
ENV CXXFLAGS_x86_64_unknown_linux_musl="--target=x86_64-unknown-linux-musl -fuse-ld=lld -nostdinc -static-libstdc++ --stdlib=c++ --rtlib=compiler-rt -nodefaultlibs -nostdinc++ -isystem $LLVM_SYSROOT/usr/include/c++/v1/ -isystem $LLVM_SYSROOT/usr/x86_64-unknown-linux-musl/include/ -isystem $LLVM_SYSROOT/usr/lib/clang/${LLVM_VERSION}/include/ -isystem $LLVM_SYSROOT/usr/x86_64-unknown-linux-musl/include/ -isystem $LLVM_SYSROOT/usr/include/linux/ "

ENV CC_s390x_unknown_linux_musl="clang"
ENV CFLAGS_s390x_unknown_linux_musl="--target=s390x-unknown-linux-musl -fuse-ld=lld -static -fPIC -nostdlib -nodefaultlibs -nostdinc -isystem $LLVM_SYSROOT/usr/lib/clang/${LLVM_VERSION}/include/ -isystem $LLVM_SYSROOT/usr/s390x-unknown-linux-musl/include/ -isystem $LLVM_SYSROOT/usr/include/linux/ -L ${LLVM_SYSROOT}/usr/x86_64-unknown-linux-musl/lib -lc -L ${LLVM_SYSROOT}/usr/lib/linux/ -lclang_rt.builtins-x86_64"
ENV CXX_s390x_unknown_linux_musl="clang++"
ENV CXXFLAGS_s390x_unknown_linux_musl="--target=s390x-unknown-linux-musl -fuse-ld=lld -nostdinc -static-libstdc++ --stdlib=c++ --rtlib=compiler-rt -nodefaultlibs -nostdinc++ -isystem $LLVM_SYSROOT/usr/include/c++/v1/ -isystem $LLVM_SYSROOT/usr/s390x-unknown-linux-musl/include/ -isystem $LLVM_SYSROOT/usr/lib/clang/${LLVM_VERSION}/include/ -isystem $LLVM_SYSROOT/usr/s390x-unknown-linux-musl/include/ -isystem $LLVM_SYSROOT/usr/include/linux/ "

ENV PCRE2_SYS_STATIC=1
ENV SYSTEMD_LIB_DIR="/lib/${CROSS_COMPILER_TARGET_ARCH}-linux-gnu"

Expand Down
14 changes: 14 additions & 0 deletions rust/debian/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ENV amd64=x86_64
ENV arm64=aarch64
ENV x86_64=amd64
ENV aarch64=arm64
ENV s390x=s390x

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US
Expand Down Expand Up @@ -109,13 +110,21 @@ ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=clang
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_AR=llvm-ar
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-args=-fuse-ld=lld \
-Clink-args=--target=x86_64-unknown-linux-musl"

ENV CARGO_TARGET_s390x_UNKNOWN_LINUX_MUSL_LINKER=clang
ENV CARGO_TARGET_s390x_UNKNOWN_LINUX_MUSL_AR=llvm-ar
ENV CARGO_TARGET_s390x_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-args=-fuse-ld=lld \
-Clink-args=--target=s390x-unknown-linux-musl"
# Teach cargo to use clang as the linker driver
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=clang
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_AR=llvm-ar

ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_AR=llvm-ar

ENV CARGO_TARGET_s390x_UNKNOWN_LINUX_GNU_LINKER=clang
ENV CARGO_TARGET_s390x_UNKNOWN_LINUX_GNU_AR=llvm-ar

# Set up basic gnu C configuration for to use clang as the linker driver, llvm-ar, ETC
ENV CC_aarch64_unknown_linux_gnu="clang"
ENV CFLAGS_aarch64_unknown_linux_gnu="--target=aarch64-unknown-linux-gnu -fuse-ld=lld -fPIC"
Expand All @@ -127,6 +136,11 @@ ENV CFLAGS_x86_64_unknown_linux_gnu="--target=x86_64-unknown-linux-gnu -fuse-ld=
ENV CXX_x86_64_unknown_linux_gnu="clang++"
ENV CXXFLAGS_x86_64_unknown_linux_gnu="--target=x86_64-unknown-linux-gnu -fuse-ld=lld -fPIC"

ENV CC_s390x_unknown_linux_gnu="clang"
ENV CFLAGS_s390x_unknown_linux_gnu="--target=s390x-unknown-linux-gnu -fuse-ld=lld -fPIC"
ENV CXX_s390x_unknown_linux_gnu="clang++"
ENV CXXFLAGS_s390x_unknown_linux_gnu="--target=s390x-unknown-linux-gnu -fuse-ld=lld -fPIC"

ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

CMD ["bash"]

0 comments on commit 838c082

Please sign in to comment.