Skip to content

Problems with cross-compilation using cargo-xwin #290

@StackOverflowExcept1on

Description

@StackOverflowExcept1on

We can't build our project with cargo-xwin. Most likely because Rust has recently tightened up some of the checks in the compiler.

export XWIN_ARCH=x86_64
export RUSTUP_HOME=/tmp/rustup_home
export WINEDEBUG=fixme-all
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER="rust-lld"

CARGO_BUILD_TARGET=x86_64-pc-windows-msvc cargo xwin build -p demo-out-of-memory
   Compiling demo-out-of-memory v0.1.0 (/home/runner/work/gear/gear/examples/out-of-memory)
error: failed to run custom build command for `demo-out-of-memory v0.1.0 (/home/runner/work/gear/gear/examples/out-of-memory)`

Caused by:
  process didn't exit successfully: `/home/runner/work/gear/gear/target/debug/build/demo-out-of-memory-2d321f2e439b93d1/build-script-build` (exit status: 1)
  --- stderr
  error: unable to invoke `cargo metadata`
  |      `cargo metadata` exited with an error: error: failed to run `rustc` to learn about target-specific information

  Caused by:
    process didn't exit successfully: `/tmp/rustup_home/toolchains/nightly-2025-05-09-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -Ctarget-feature=+crt-static -C linker-flavor=lld-link -Lnative=/home/runner/.cache/cargo-xwin/xwin/crt/lib/x86_64 -Lnative=/home/runner/.cache/cargo-xwin/xwin/sdk/lib/um/x86_64 -Lnative=/home/runner/.cache/cargo-xwin/xwin/sdk/lib/ucrt/x86_64 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg -Wwarnings` (exit status: 1)
    --- stdout
    ___
    lib___.rlib
    lib___.a
    /tmp/rustup_home/toolchains/nightly-2025-05-09-x86_64-unknown-linux-gnu
    off
    packed
    unpacked
    ___
    debug_assertions
    fmt_debug="full"
    overflow_checks
    panic="unwind"
    proc_macro
    relocation_model="pic"
    target_abi=""
    target_arch="x86_64"
    target_endian="little"
    target_env="gnu"
    target_family="unix"
    target_feature="crt-static"
    target_feature="fxsr"
    target_feature="sse"
    target_feature="sse2"
    target_feature="x87"
    target_has_atomic
    target_has_atomic="16"
    target_has_atomic="32"
    target_has_atomic="64"
    target_has_atomic="8"
    target_has_atomic="ptr"
    target_has_atomic_equal_alignment="16"
    target_has_atomic_equal_alignment="32"
    target_has_atomic_equal_alignment="64"
    target_has_atomic_equal_alignment="8"
    target_has_atomic_equal_alignment="ptr"
    target_has_atomic_load_store
    target_has_atomic_load_store="16"
    target_has_atomic_load_store="32"
    target_has_atomic_load_store="64"
    target_has_atomic_load_store="8"
    target_has_atomic_load_store="ptr"
    target_has_reliable_f128
    target_has_reliable_f16
    target_has_reliable_f16_math
    target_os="linux"
    target_pointer_width="64"
    target_thread_local
    target_vendor="unknown"
    ub_checks
    unix

    --- stderr
    error: linker flavor `lld-link` is incompatible with the current target
      |
      = note: compatible flavors are: gnu, gnu-lld, gnu-cc, gnu-lld-cc, gcc, ld, ld.lld

    warning: dropping unsupported crate type `dylib` for target `x86_64-unknown-linux-gnu`

    warning: dropping unsupported crate type `cdylib` for target `x86_64-unknown-linux-gnu`

    warning: dropping unsupported crate type `proc-macro` for target `x86_64-unknown-linux-gnu`

    error: aborting due to 1 previous error; 3 warnings emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions