#Cross compiling with cross.rs

12 messages · Page 1 of 1 (latest)

young bobcat
#

Hello,
is it possible to cross compile a Tauri app with https://github.com/cross-rs/cross ?
To cross compile a binary crate I normally run CROSS_CONTAINER_ENGINE=podman cross build --release --target x86_64-pc-windows-gnu but this doesn't work in the context of a tauri app since it only compiles the backend

GitHub

“Zero setup” cross compilation and “cross testing” of Rust crates - GitHub - cross-rs/cross: “Zero setup” cross compilation and “cross testing” of Rust crates

neat prawn
#

Is your frontend platform-dependent?

young bobcat
#

No, I use Solid js

neat prawn
#

Then I don't understand the issue. You said the above command doesn't work since it only compiles the backend, but the backend is the only platform-specific part.

boreal turtle
#

you can change tauri's runner directly: https://tauri.app/v1/api/config#buildconfig.runner. So if you set this to cross (instead of cargo) it should work the same as normally == beforeBuildCommand is executed and the paackages should be bundled too, depending on the target (most of the bundles can only be created on the target platform)

young bobcat
# boreal turtle you can change tauri's runner directly: <https://tauri.app/v1/api/config#buildco...

I added "runner": "cross" in my tauri.conf.json under the build configuration object and run CROSS_CONTAINER_ENGINE=podman cargo tauri build --target x86_64-pc-windows-gnu but it doesn't seem to run a container and just runs like it would without cross
I also get the same error as with a classic (without runner: cross) cargo tauri build --target x86_64-pc-windows-gnuwhich is linker x86_64-w64-mingw32-gcc not found

boreal turtle
#

hmm, maybe it's not forwarding the target args. Can you try CROSS_CONTAINER_ENGINE=podman cargo tauri build --target x86_64-pc-windows-gnu -- --target x86_64-pc-windows-gnu? (first one for tauri, second one for the runner)

young bobcat
#

I get the same error as before
Also, if I remove CROSS_CONTAINER_ENGINE=podman, I don't get an error that I would normally get when running cross

#

This is my tauri.conf.json if it can help

brave zealot
#

don't know if it matters, but identifiers have dots, not dashes

young bobcat
brave zealot
#

Figures