From ca0d4e9aac7c96f84649e26064d996c04b27b243 Mon Sep 17 00:00:00 2001 From: Skgland Date: Sat, 25 Apr 2026 21:27:03 +0200 Subject: [PATCH 1/6] add miri CI for a big endian target --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b58d2a90..912932e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,8 @@ jobs: - { os: ubuntu-22.04, rust-version: "${{ needs.read-msrv.outputs.msrv }}" , target: 'x86_64-unknown-linux-gnu'} - { os: ubuntu-22.04, rust-version: beta, target: 'x86_64-unknown-linux-gnu'} - { os: ubuntu-22.04, rust-version: nightly, target: 'x86_64-unknown-linux-gnu', miri: true, components: "miri"} + # run miri for a big-endian target, without features that require a native library i.e. without crypto, crypto-full, ffi, http, tls + - { os: ubuntu-22.04, rust-version: nightly, target: 's390x-unknown-linux-gnu', miri: true, components: "miri", args: '--no-default-features --features=repl,hostname', test-args: '--no-run --no-default-features --features=repl,hostname', miri-args: '--no-default-features --features=repl,hostname' } defaults: run: shell: bash From f16850e5f8c2f2ffbb57eac104edfbb56094aff4 Mon Sep 17 00:00:00 2001 From: Skgland Date: Sat, 25 Apr 2026 21:41:59 +0200 Subject: [PATCH 2/6] fix ci and setup cross-compilation --- .cargo/config.toml | 2 ++ .github/actions/setup-rust/action.yml | 7 +++++++ .github/workflows/ci.yml | 14 ++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..8971f27a --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.s390x-unknown-linux-gnu] +linker = "/usr/bin/s390x-linux-gnu-gcc" diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index 45f087e6..c30064eb 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -32,6 +32,13 @@ runs: sudo apt-get install libssl-dev:i386 gcc-multilib clang -y echo "CC=clang" >> $GITHUB_ENV echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV + + - name: Install s390x cross-compilation toolchain + if: ${{ matrix.target == 's390x-unknown-linux-gnu' }} + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y gcc-s390x-linux-gnu - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 912932e4..1f3d6905 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,20 +61,22 @@ jobs: # FIXME(issue #2138): run wasm tests, failing to run since https://github.com/mthom/scryer-prolog/pull/2137 removed wasm-pack - { os: ubuntu-22.04, rust-version: nightly, target: 'wasm32-unknown-unknown', publish: true, args: '--no-default-features' , test-args: '--no-run --no-default-features', use_swap: true } # Cargo.toml rust-version - - { os: ubuntu-22.04, rust-version: "${{ needs.read-msrv.outputs.msrv }}" , target: 'x86_64-unknown-linux-gnu'} - - { os: ubuntu-22.04, rust-version: beta, target: 'x86_64-unknown-linux-gnu'} - - { os: ubuntu-22.04, rust-version: nightly, target: 'x86_64-unknown-linux-gnu', miri: true, components: "miri"} - # run miri for a big-endian target, without features that require a native library i.e. without crypto, crypto-full, ffi, http, tls - - { os: ubuntu-22.04, rust-version: nightly, target: 's390x-unknown-linux-gnu', miri: true, components: "miri", args: '--no-default-features --features=repl,hostname', test-args: '--no-run --no-default-features --features=repl,hostname', miri-args: '--no-default-features --features=repl,hostname' } + - { os: ubuntu-22.04, rust-version: "${{ needs.read-msrv.outputs.msrv }}" , target: 'x86_64-unknown-linux-gnu' } + - { os: ubuntu-22.04, rust-version: beta, target: 'x86_64-unknown-linux-gnu' } + - { os: ubuntu-22.04, rust-version: nightly, target: 'x86_64-unknown-linux-gnu', miri: true, components: "miri" } + # run miri for a big-endian target, without features that require openssl i.e. without http, tls + - { os: ubuntu-22.04, rust-version: nightly, target: 's390x-unknown-linux-gnu', miri: true, components: "miri", args: '--no-default-features --features=repl,hostname,crypto-full,ffi', test-args: '--no-run --no-default-features --features=repl,hostname,crypto-full,ffi' } defaults: run: shell: bash steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actionhippie/swap-space@0cffa893f224708cfb6b011690d8ba819d69c10f # v1.1.0 if: matrix.use_swap with: size: 10G + - name: Setup Rust uses: ./.github/actions/setup-rust with: @@ -91,7 +93,7 @@ jobs: - name: Check miri if: matrix.miri - run: cargo miri test + run: cargo miri test ${{ matrix.args }} # On stable rust builds, build a binary and publish as a github actions # artifact. These binaries could be useful for testing the pipeline but From e0c491e9f33c93e338cca3ab6d4d9ee0c2e01ced Mon Sep 17 00:00:00 2001 From: Skgland Date: Sun, 26 Apr 2026 00:17:33 +0200 Subject: [PATCH 3/6] fix miri not being passed the target --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f3d6905..8c118e53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,7 @@ jobs: - name: Check miri if: matrix.miri - run: cargo miri test ${{ matrix.args }} + run: cargo miri test --target ${{ matrix.target }} ${{ matrix.args }} # On stable rust builds, build a binary and publish as a github actions # artifact. These binaries could be useful for testing the pipeline but From 550efb8416c0b3f53fab5ad6722d7a74da398416 Mon Sep 17 00:00:00 2001 From: Skgland Date: Mon, 27 Apr 2026 21:33:08 +0200 Subject: [PATCH 4/6] add a feature for things that are simple to cross-compile --- .github/workflows/ci.yml | 4 ++-- Cargo.toml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c118e53..ff0993a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,8 +64,8 @@ jobs: - { os: ubuntu-22.04, rust-version: "${{ needs.read-msrv.outputs.msrv }}" , target: 'x86_64-unknown-linux-gnu' } - { os: ubuntu-22.04, rust-version: beta, target: 'x86_64-unknown-linux-gnu' } - { os: ubuntu-22.04, rust-version: nightly, target: 'x86_64-unknown-linux-gnu', miri: true, components: "miri" } - # run miri for a big-endian target, without features that require openssl i.e. without http, tls - - { os: ubuntu-22.04, rust-version: nightly, target: 's390x-unknown-linux-gnu', miri: true, components: "miri", args: '--no-default-features --features=repl,hostname,crypto-full,ffi', test-args: '--no-run --no-default-features --features=repl,hostname,crypto-full,ffi' } + # run miri for a big-endian target, with all features that are simple to get cross-compiled + - { os: ubuntu-22.04, rust-version: nightly, target: 's390x-unknown-linux-gnu', miri: true, components: "miri", args: '--no-default-features --features=all-simple-cross', test-args: '--no-run --no-default-features --features=all-simple-cross' } defaults: run: shell: bash diff --git a/Cargo.toml b/Cargo.toml index 0494a679..948444a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,9 @@ crate-type = ["cdylib", "rlib"] [features] default = ["ffi", "repl", "hostname", "tls", "http", "crypto-full"] +# enables all features that are simple to get working for cross-compliation +# currently all but tls, http as those depend on openssl +all-simple-cross = ["ffi", "repl", "hostname", "crypto-full"] ffi = ["dep:libffi"] repl = ["dep:crossterm", "dep:ctrlc", "dep:rustyline"] hostname = ["dep:hostname"] From 19974e580bf54b0c95167706896b2295cb524a26 Mon Sep 17 00:00:00 2001 From: Skgland Date: Sun, 24 May 2026 19:02:23 +0200 Subject: [PATCH 5/6] fix missing description Github documentation states that it is a required field and my linter complained https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#description --- .github/actions/setup-rust/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index c30064eb..ebcb820c 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -1,4 +1,7 @@ name: 'Setup Rust' +description: | + Setup the rust toolchain and environment for the selected toolchain + inputs: rust-version: required: true From 1fd9246b1604aede6262dd0595effe6dc6e8639e Mon Sep 17 00:00:00 2001 From: Skgland Date: Sun, 24 May 2026 19:02:59 +0200 Subject: [PATCH 6/6] configure linker via env var insread of .cargo/config.toml someone might already have a .cargo/config.toml --- .cargo/config.toml | 2 -- .github/actions/setup-rust/action.yml | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 8971f27a..00000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.s390x-unknown-linux-gnu] -linker = "/usr/bin/s390x-linux-gnu-gcc" diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index ebcb820c..e2bfc4de 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -35,13 +35,14 @@ runs: sudo apt-get install libssl-dev:i386 gcc-multilib clang -y echo "CC=clang" >> $GITHUB_ENV echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV - + - name: Install s390x cross-compilation toolchain if: ${{ matrix.target == 's390x-unknown-linux-gnu' }} shell: bash run: | sudo apt-get update sudo apt-get install -y gcc-s390x-linux-gnu + echo "CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc" >> $GITHUB_ENV - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 with: