From 96c81f2ceca60b586a4b792da56ab15cfb18aeb8 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 10:53:37 +0200 Subject: [PATCH 1/8] [RISCV64][CI] Use simpler way to install riscv64 packages --- .github/cross-linux-riscv64/install_deb.sh | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/cross-linux-riscv64/install_deb.sh b/.github/cross-linux-riscv64/install_deb.sh index a38715c2762..4cc91e4f278 100755 --- a/.github/cross-linux-riscv64/install_deb.sh +++ b/.github/cross-linux-riscv64/install_deb.sh @@ -15,30 +15,30 @@ apt-get install --assume-yes --no-install-recommends \ sharutils \ gnupg -# Add port from sid to get some riscv packages -debsource="deb http://deb.debian.org/debian-ports sid main" - -# temporarily use debian sources rather than ubuntu. -touch /etc/apt/sources.list -mv /etc/apt/sources.list /etc/apt/sources.list.bak -echo -e "${debsource}" > /etc/apt/sources.list +## Add port from bookworm to get some riscv packages +#debsource="deb http://deb.debian.org/debian-ports bookworm main" +# +## temporarily use debian sources rather than ubuntu. +#touch /etc/apt/sources.list +#mv /etc/apt/sources.list /etc/apt/sources.list.bak +#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 - -# allow apt-get to retry downloads -echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries +#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{7.0,8,9,10,11}.asc' -O +#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{8,9,10,11}-security.asc' -O +#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{7,8,9,10,11}.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 +# +## allow apt-get to retry downloads +#echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries apt-get update for dep in $@; do From 62991339b75277c85de6c0fea23d8f5a09483a7f Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 10:59:07 +0200 Subject: [PATCH 2/8] [RISCV64][CI] Still need debian-port --- .github/cross-linux-riscv64/install_deb.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/cross-linux-riscv64/install_deb.sh b/.github/cross-linux-riscv64/install_deb.sh index 4cc91e4f278..00375fa682c 100755 --- a/.github/cross-linux-riscv64/install_deb.sh +++ b/.github/cross-linux-riscv64/install_deb.sh @@ -15,13 +15,13 @@ apt-get install --assume-yes --no-install-recommends \ sharutils \ gnupg -## Add port from bookworm to get some riscv packages -#debsource="deb http://deb.debian.org/debian-ports bookworm main" -# -## temporarily use debian sources rather than ubuntu. -#touch /etc/apt/sources.list -#mv /etc/apt/sources.list /etc/apt/sources.list.bak -#echo -e "${debsource}" > /etc/apt/sources.list +# Add port from bookworm to get some riscv packages +debsource="deb http://deb.debian.org/debian-ports bookworm main" + +# temporarily use debian sources rather than ubuntu. +touch /etc/apt/sources.list +mv /etc/apt/sources.list /etc/apt/sources.list.bak +echo -e "${debsource}" > /etc/apt/sources.list dpkg --add-architecture "${arch}" || echo "foreign-architecture ${arch}" \ > /etc/dpkg/dpkg.cfg.d/multiarch From 0780b555cbbf124908a805e33f13b5985813791b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 11:04:59 +0200 Subject: [PATCH 3/8] [RISCV64][CI] try unstable debian-port --- .github/cross-linux-riscv64/install_deb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/cross-linux-riscv64/install_deb.sh b/.github/cross-linux-riscv64/install_deb.sh index 00375fa682c..9cc89066a70 100755 --- a/.github/cross-linux-riscv64/install_deb.sh +++ b/.github/cross-linux-riscv64/install_deb.sh @@ -16,7 +16,7 @@ apt-get install --assume-yes --no-install-recommends \ gnupg # Add port from bookworm to get some riscv packages -debsource="deb http://deb.debian.org/debian-ports bookworm main" +debsource="deb http://deb.debian.org/debian-ports unstable main" # temporarily use debian sources rather than ubuntu. touch /etc/apt/sources.list From 90e3c3db3847e816bf7631db4b6f2d89036566a4 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 11:12:00 +0200 Subject: [PATCH 4/8] [RISCV64][CI] restrict pgp keys --- .github/cross-linux-riscv64/install_deb.sh | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/cross-linux-riscv64/install_deb.sh b/.github/cross-linux-riscv64/install_deb.sh index 9cc89066a70..adecacb636e 100755 --- a/.github/cross-linux-riscv64/install_deb.sh +++ b/.github/cross-linux-riscv64/install_deb.sh @@ -27,18 +27,18 @@ 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,11}.asc' -O -#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{8,9,10,11}-security.asc' -O -#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{7,8,9,10,11}.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 -# -## allow apt-get to retry downloads -#echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries +curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{12,13}.asc' -O +curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{12,13}-security.asc' -O +curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{12,13}.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 apt-get update for dep in $@; do From d84182a21d9df541cb8c320dcf9023bdbb1cc22c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 11:15:07 +0200 Subject: [PATCH 5/8] [RISCV64][CI] better restrict pgp keys --- .github/cross-linux-riscv64/install_deb.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/cross-linux-riscv64/install_deb.sh b/.github/cross-linux-riscv64/install_deb.sh index adecacb636e..d8717561740 100755 --- a/.github/cross-linux-riscv64/install_deb.sh +++ b/.github/cross-linux-riscv64/install_deb.sh @@ -27,9 +27,9 @@ 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-{12,13}.asc' -O -curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{12,13}-security.asc' -O -curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{12,13}.asc' -O +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 From f59e15b16e259e16ea11f98feedf5f19ddc0d63b Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 11:18:22 +0200 Subject: [PATCH 6/8] [RISCV64][CI] Use testing --- .github/cross-linux-riscv64/install_deb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/cross-linux-riscv64/install_deb.sh b/.github/cross-linux-riscv64/install_deb.sh index d8717561740..e312d202298 100755 --- a/.github/cross-linux-riscv64/install_deb.sh +++ b/.github/cross-linux-riscv64/install_deb.sh @@ -16,7 +16,7 @@ apt-get install --assume-yes --no-install-recommends \ gnupg # Add port from bookworm to get some riscv packages -debsource="deb http://deb.debian.org/debian-ports unstable main" +debsource="deb http://deb.debian.org/debian-ports testing main" # temporarily use debian sources rather than ubuntu. touch /etc/apt/sources.list From 44d85a24f3000805f0acad35a9c308e14dcc4d9c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 14:15:56 +0200 Subject: [PATCH 7/8] [RISCV64][CI] Switch to custom build openssl --- .github/cross-linux-riscv64/Dockerfile | 21 +++++++++++++----- .github/cross-linux-riscv64/build_openssl.sh | 16 ++++++++++++++ .github/cross-linux-riscv64/install_deb.sh | 23 ++++++++++---------- 3 files changed, 43 insertions(+), 17 deletions(-) create mode 100755 .github/cross-linux-riscv64/build_openssl.sh diff --git a/.github/cross-linux-riscv64/Dockerfile b/.github/cross-linux-riscv64/Dockerfile index 18382aeb6ae..f9aabb931fa 100644 --- a/.github/cross-linux-riscv64/Dockerfile +++ b/.github/cross-linux-riscv64/Dockerfile @@ -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 @@ -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 @@ -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 diff --git a/.github/cross-linux-riscv64/build_openssl.sh b/.github/cross-linux-riscv64/build_openssl.sh new file mode 100755 index 00000000000..607036c4c32 --- /dev/null +++ b/.github/cross-linux-riscv64/build_openssl.sh @@ -0,0 +1,16 @@ +#!/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=/opensll_riscv64 linux64-riscv64 +make -j +make install diff --git a/.github/cross-linux-riscv64/install_deb.sh b/.github/cross-linux-riscv64/install_deb.sh index e312d202298..20f3e369a1d 100755 --- a/.github/cross-linux-riscv64/install_deb.sh +++ b/.github/cross-linux-riscv64/install_deb.sh @@ -13,10 +13,11 @@ apt-get install --assume-yes --no-install-recommends \ curl \ cpio \ sharutils \ + debian-ports-archive-keyring \ gnupg # Add port from bookworm to get some riscv packages -debsource="deb http://deb.debian.org/debian-ports testing main" +debsource="deb http://deb.debian.org/debian-ports unstable main" # temporarily use debian sources rather than ubuntu. touch /etc/apt/sources.list @@ -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-{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 +## 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 From bd031799024e196fc7a7f76b3afefa41c0e23681 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 16 Jun 2023 14:38:42 +0200 Subject: [PATCH 8/8] [RISCV64][CI] Fixed typos --- .github/cross-linux-riscv64/build_openssl.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/cross-linux-riscv64/build_openssl.sh b/.github/cross-linux-riscv64/build_openssl.sh index 607036c4c32..f42adc11e06 100755 --- a/.github/cross-linux-riscv64/build_openssl.sh +++ b/.github/cross-linux-riscv64/build_openssl.sh @@ -11,6 +11,7 @@ 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=/opensll_riscv64 linux64-riscv64 + ./Configure -static no-asm no-tests --prefix=/openssl_riscv64 linux64-riscv64 + make -j make install