Repository: cross-rs/cross (rust)

Issue:
Fix zig image
[zig](https://github.com/cross-rs/cross/actions/runs/7703230077/job/20993312365) - ❌

```
     Running `/target/debug/build/hellopp-4198e14c1842cfb5/build-script-build`
The following warnings were emitted during compilation:

warning: hellopp@0.1.0: error: unsupported linker arg: -melf_i386

error: failed to run custom build command for `hellopp v0.1.0 (/tmp/tmp.JaHyf9r5NC)`

Caused by:
  process didn't exit successfully: `/target/debug/build/hellopp-4198e14c1842cfb5/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("i586-unknown-linux-musl")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  CXX_i586-unknown-linux-musl = None
  CXX_i586_unknown_linux_musl = Some("/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-i586-unknown-linux-musl.sh")
  CXXFLAGS_i586-unknown-linux-musl = None
  CXXFLAGS_i586_unknown_linux_musl = None
  TARGET_CXXFLAGS = None
  CXXFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = None
  running: "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-i586-unknown-linux-musl.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m32" "-march=pentium" "-Wl,-melf_i386" "-Wall" "-Wextra" "-o" "/target/i586-unknown-linux-musl/debug/build/hellopp-d2cec04140b3245e/out/hellopp.o" "-c" "hellopp.cc"
  cargo:warning=error: unsupported linker arg: -melf_i386
  exit status: 1

  --- stderr


  error occurred: Command "/target/.zig-cache/cargo-zigbuild/0.17.3/zigcxx-i586-unknown-linux-musl.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m32" "-march=pentium" "-Wl,-melf_i386" "-Wall" "-Wextra" "-o" "/target/i586-unknown-linux-musl/debug/build/hellopp-d2cec04140b3245e/out/hellopp.o" "-c" "hellopp.cc" with args "zigcxx-i586-unknown-linux-musl.sh" did not execute successfully (status code exit status: 1).
```

this error is https://github.com/rust-cross/cargo-zigbuild/issues/96

I'm not sure if this is our fault or zigbuild

Pull request:
disable/fix failing targets
Touches on 
#1422 
#1423 
#1424 

resolves #1425 (kinda)


Patch:
diff --git a/src/docker/provided_images.rs b/src/docker/provided_images.rs
index f97d732..b7eacc2 100644
--- a/src/docker/provided_images.rs
+++ b/src/docker/provided_images.rs
@@ -78,16 +78,6 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[
             platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
             sub: None
         },
-        ProvidedImage {
-            name: "mips64-unknown-linux-muslabi64",
-            platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
-            sub: None
-        },
-        ProvidedImage {
-            name: "mips64el-unknown-linux-muslabi64",
-            platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
-            sub: None
-        },
         ProvidedImage {
             name: "powerpc-unknown-linux-gnu",
             platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
@@ -163,16 +153,6 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[
             platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
             sub: None
         },
-        ProvidedImage {
-            name: "mips-unknown-linux-musl",
-            platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
-            sub: None
-        },
-        ProvidedImage {
-            name: "mipsel-unknown-linux-musl",
-            platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
-            sub: None
-        },
         ProvidedImage {
             name: "aarch64-linux-android",
             platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
@@ -243,16 +223,6 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[
             platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
             sub: None
         },
-        ProvidedImage {
-            name: "sparcv9-sun-solaris",
-            platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
-            sub: None
-        },
-        ProvidedImage {
-            name: "x86_64-sun-solaris",
-            platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
-            sub: None
-        },
         ProvidedImage {
             name: "x86_64-unknown-illumos",
             platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU],
diff --git a/targets.toml b/targets.toml
index 5aa40ca..042f8ba 100644
--- a/targets.toml
+++ b/targets.toml
@@ -154,6 +154,7 @@ runners = "qemu-user qemu-system"
 build-std = true
 
 [[target]]
+disabled = true # https://github.com/cross-rs/cross/issues/1422
 target = "mips64-unknown-linux-muslabi64"
 os = "ubuntu-latest"
 cpp = true
@@ -163,6 +164,7 @@ run = true
 build-std = true
 
 [[target]]
+disabled = true # https://github.com/cross-rs/cross/issues/1422
 target = "mips64el-unknown-linux-muslabi64"
 os = "ubuntu-latest"
 # FIXME: Lacking partial C++ support due to missing compiler builtins.
@@ -302,6 +304,7 @@ run = true
 runners = "qemu-user"
 
 [[target]]
+disabled = true # https://github.com/cross-rs/cross/issues/1422
 target = "mips-unknown-linux-musl"
 os = "ubuntu-latest"
 cpp = true
@@ -311,6 +314,7 @@ run = true
 build-std = true
 
 [[target]]
+disabled = true # https://github.com/cross-rs/cross/issues/1422
 target = "mipsel-unknown-linux-musl"
 os = "ubuntu-latest"
 cpp = true
@@ -380,13 +384,14 @@ cpp = true
 std = true
 run = true
 
+[[target]]
 # Disabled for now, see https://github.com/rust-lang/rust/issues/98216 & https://github.com/cross-rs/cross/issues/634
-# [[target]]
-# target = "asmjs-unknown-emscripten"
-# os = "ubuntu-latest"
-# cpp = true
-# std = true
-# run = true
+disabled = true
+target = "asmjs-unknown-emscripten"
+os = "ubuntu-latest"
+cpp = true
+std = true
+run = true
 
 [[target]]
 target = "wasm32-unknown-emscripten"
@@ -433,6 +438,7 @@ dylib = true
 std = true
 
 [[target]]
+disabled = true # https://github.com/cross-rs/cross/issues/1424
 target = "sparcv9-sun-solaris"
 os = "ubuntu-latest"
 cpp = true
@@ -440,6 +446,7 @@ dylib = true
 std = true
 
 [[target]]
+disabled = true # https://github.com/cross-rs/cross/issues/1424
 target = "x86_64-sun-solaris"
 os = "ubuntu-latest"
 cpp = true
diff --git a/xtask/src/build_docker_image.rs b/xtask/src/build_docker_image.rs
index cf22e3c..c747aba 100644
--- a/xtask/src/build_docker_image.rs
+++ b/xtask/src/build_docker_image.rs
@@ -137,6 +137,7 @@ pub fn build_docker_image(
             targets = get_matrix()
                 .iter()
                 .filter(|m| m.os.starts_with("ubuntu"))
+                .filter(|m| !m.disabled)
                 .map(|m| m.to_image_target())
                 .collect();
         } else {
diff --git a/xtask/src/ci/target_matrix.rs b/xtask/src/ci/target_matrix.rs
index cc6779c..4b8a518 100644
--- a/xtask/src/ci/target_matrix.rs
+++ b/xtask/src/ci/target_matrix.rs
@@ -34,6 +34,7 @@ pub enum TargetMatrixSub {
 impl TargetMatrix {
     pub(crate) fn run(&self) -> Result<(), color_eyre::Report> {
         let mut matrix: Vec<CiTarget> = get_matrix().clone();
+        matrix.retain(|t| !t.disabled);
         let mut is_default_try = false;
         let pr: Option<String>;
         let (prs, mut app) = match self {
@@ -411,6 +412,7 @@ mod tests {
     #[track_caller]
     fn run<'a>(args: impl IntoIterator<Item = &'a str>) -> Vec<CiTarget> {
         let mut matrix = get_matrix().clone();
+        matrix.retain_mut(|t| !t.disabled);
         TargetMatrixArgs::try_parse_from(args)
             .unwrap()
             .filter(&mut matrix);
@@ -468,7 +470,9 @@ mod tests {
     #[test]
     fn all() {
         let matrix = run([]);
-        assert_eq!(get_matrix(), &matrix);
+        let mut all = get_matrix().clone();
+        all.retain(|t| !t.disabled);
+        assert_eq!(&all, &matrix);
     }
 
     #[test]
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index e835c4e..790d8ae 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -5,11 +5,7 @@ use std::fmt::Write;
 use crate::util::{get_cargo_workspace, get_matrix};
 
 #[derive(Args, Debug)]
-pub struct Codegen {
-    /// Provide verbose diagnostic output.
-    #[clap(short, long)]
-    verbose: bool,
-}
+pub struct Codegen {}
 
 pub fn codegen(Codegen { .. }: Codegen) -> cross::Result<()> {
     let path = get_cargo_workspace().join("src/docker/provided_images.rs");
@@ -28,7 +24,7 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &["#,
 
     for image_target in get_matrix()
         .iter()
-        .filter(|i| i.builds_image() && i.to_image_target().is_toolchain_image())
+        .filter(|i| i.builds_image() && i.to_image_target().is_toolchain_image() && !i.disabled)
     {
         write!(
             &mut images,
diff --git a/xtask/src/util.rs b/xtask/src/util.rs
index 11343e4..04f1b8c 100644
--- a/xtask/src/util.rs
+++ b/xtask/src/util.rs
@@ -64,6 +64,12 @@ pub struct CiTarget {
     /// if `true` test no std support as if std does exists. If `false` build https://github.com/rust-lang/compiler-builtins
     #[serde(skip_serializing_if = "Option::is_none")]
     pub std: Option<bool>,
+    #[serde(skip_serializing_if = "is_false", default)]
+    pub disabled: bool,
+}
+
+pub fn is_false(b: &bool) -> bool {
+    !*b
 }
 
 impl CiTarget {


Test patch:
diff --git a/ci/test-zig-image.sh b/ci/test-zig-image.sh
index 6b3092d..2fdddc1 100755
--- a/ci/test-zig-image.sh
+++ b/ci/test-zig-image.sh
@@ -16,8 +16,9 @@ ci_dir=$(realpath "${ci_dir}")
 TARGETS=(
     "aarch64-unknown-linux-gnu"
     "aarch64-unknown-linux-musl"
-    "i586-unknown-linux-gnu"
-    "i586-unknown-linux-musl"
+    # disabled, see https://github.com/cross-rs/cross/issues/1425
+    #"i586-unknown-linux-gnu"
+    #"i586-unknown-linux-musl"
 )
 
 # on CI, it sets `CROSS_TARGET_ZIG_IMAGE` rather than `CROSS_BUILD_ZIG_IMAGE`
diff --git a/ci/test.sh b/ci/test.sh
index eaa4f5d..6a164ae 100755
--- a/ci/test.sh
+++ b/ci/test.sh
@@ -48,6 +48,10 @@ main() {
         # don't use xargo: should have native support just from rustc
         rustup toolchain add nightly
         CROSS+=("+nightly")
+    elif [[ "${TARGET}" == "riscv64gc-unknown-linux-gnu" ]]; then
+        # FIXME: riscv64gc-unknown-linux-gnu is broken on rustc 1.75, see https://github.com/cross-rs/cross/issues/1423
+        rustup toolchain add 1.70
+        CROSS+=("+1.70")
     fi
 
     if (( ${STD:-0} )); then
@@ -89,6 +93,7 @@ main() {
         popd
 
         rm -rf "${td}"
+    # thumb targets are tested in later steps
     elif [[ "${TARGET}" != thumb* ]]; then
         td=$(mkcargotemp -d)