slint icon indicating copy to clipboard operation
slint copied to clipboard

Document how to cross-compile from Linux to Windows

Open qarmin opened this issue 1 year ago • 3 comments

Slint 1.2.2 Ubuntu 22.04

When trying to cross-compile app from linux to windows, after disabling QT which causes problem, running app under wine crashed with message

thread 'main' panicked at internal/common/sharedfontdb.rs:151:13:
Unable to determine default font. Failed to locate font for family Arial
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I used cargo directly instead cross, because I had problems in running cross in CI. To remove such problems in future, probably in docs should be added simple message how to properly setup linux, to be able to test windows binaries

With gallery example, I was able to run windows app on linux with this commands

sudo apt install mingw-w64 mingw-w64-x86-64-dev winetricks wine
winetricks corefonts
cd slint/examples/gallery
SLINT_NO_QT=1 cargo build --target x86_64-pc-windows-gnu
cd ../../target/x86_64-pc-windows-gnu/debug/
wine gallery.exe

qarmin avatar Oct 07 '23 22:10 qarmin

The error message suggests an insufficient installation of windows fonts. On startup we use fontdb, which looks for fonts in C:\Windows\Fonts\ . In the corresponding directory on your Linux machine, what are the directory contents?

tronical avatar Oct 08 '23 08:10 tronical

In empty prefix this folder is also empty.

Like I wrote in first post, fonts can be installed via winetricks corefonts, but I think that this info should be added to docs, because in cross cannot be always used and in this case is completely unnecessary

qarmin avatar Oct 08 '23 12:10 qarmin

Like I wrote in first post, fonts can be installed via winetricks corefonts,

Indeed, I missed that - apologies.

but I think that this info should be added to docs, because in cross cannot be always used and in this case is completely unnecessary

Personally I don't see much of a use-case of running a Slint application under wine when the application can be built for Linux "natively". So I feel that this might add more noise to the documentation than signal. But we can leave this issue open for others to find it and of course anyone is welcome to contribute to the documentation.

tronical avatar Oct 10 '23 07:10 tronical