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

[RISCV64][CI] Use simpler way to install riscv64 packages #4002

Merged
merged 8 commits into from
Jun 16, 2023
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
21 changes: 15 additions & 6 deletions .github/cross-linux-riscv64/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM debian:bookworm AS openssl_riscv64
#FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge
FROM debian:unstable AS openssl_riscv64
#FROM ghcr.io/cross-rs/riscv64gc-unknown-linux-gnu:edge AS openssl_riscv64

# set CROSS_DOCKER_IN_DOCKER to inform `cross` that it is executed from within a container
ENV CROSS_DOCKER_IN_DOCKER=true
Expand All @@ -14,12 +14,15 @@ RUN apt-get update && \
build-essential \
libc6-dev

COPY install_deb.sh /
#COPY install_deb.sh /

#install libssl-dev for riscv64!
RUN /install_deb.sh riscv64 libssl-dev
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/riscv64-linux-gnu
#RUN /install_deb.sh riscv64 libssl-dev
#RUN dpkg --add-architecture riscv64
#RUN apt-get update
#RUN apt-get install libssl-dev:riscv64
#ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include
#ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/riscv64-linux-gnu


# install rust tools
Expand Down Expand Up @@ -59,3 +62,9 @@ ENV CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc
PKG_CONFIG_PATH="/usr/lib/riscv64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}"

RUN rustup target add riscv64gc-unknown-linux-gnu --toolchain 1.67-x86_64-unknown-linux-gnu

#compile libssl-dev for riscv64!
COPY build_openssl.sh /
RUN /build_openssl.sh
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/openssl_riscv64/include
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/openssl_riscv64/lib
17 changes: 17 additions & 0 deletions .github/cross-linux-riscv64/build_openssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -x
set -euo pipefail

apt-get install wget

wget https://www.openssl.org/source/openssl-3.1.1.tar.gz

tar xf openssl-3.1.1.tar.gz
rm openssl-3.1.1.tar.gz
cd openssl-3.1.1

AR=riscv64-linux-gnu-ar NM=riscv64-linux-gnu-nm CC=riscv64-linux-gnu-gcc \
./Configure -static no-asm no-tests --prefix=/openssl_riscv64 linux64-riscv64

make -j
make install
25 changes: 13 additions & 12 deletions .github/cross-linux-riscv64/install_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ apt-get install --assume-yes --no-install-recommends \
curl \
cpio \
sharutils \
debian-ports-archive-keyring \
gnupg

# Add port from sid to get some riscv packages
debsource="deb http://deb.debian.org/debian-ports sid main"
# Add port from bookworm to get some riscv packages
debsource="deb http://deb.debian.org/debian-ports unstable main"

# temporarily use debian sources rather than ubuntu.
touch /etc/apt/sources.list
Expand All @@ -26,16 +27,16 @@ echo -e "${debsource}" > /etc/apt/sources.list
dpkg --add-architecture "${arch}" || echo "foreign-architecture ${arch}" \
> /etc/dpkg/dpkg.cfg.d/multiarch

# Add Debian keys.
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{7.0,8,9,10}.asc' -O
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{8,9,10}-security.asc' -O
curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{7,8,9,10}.asc' -O
curl --retry 3 -sSfL 'https://www.ports.debian.org/archive_{2020,2021,2022,2023}.key' -O

for key in *.asc *.key; do
apt-key add "${key}"
rm "${key}"
done
## Add Debian keys.
#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{11,12}.asc' -O
#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{11,12}-security.asc' -O
#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{11,12}.asc' -O
#curl --retry 3 -sSfL 'https://www.ports.debian.org/archive_{2023}.key' -O
#
#for key in *.asc *.key; do
# apt-key add "${key}"
# rm "${key}"
#done

# allow apt-get to retry downloads
echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries
Expand Down