qarmin
(Rafał Mikrut)
October 4, 2020, 4:45am
1
Hi,
I want to cross compile my app using Linux to Windows, but sadly each tutorial require Windows prebuild binaries which should exists here http://win32builder.gnome.org/
The GTK Project - A free and open-source cross-platform widget toolkit only points to Windows only method to compile app.
2 Likes
ebassi
(Emmanuele Bassi)
October 4, 2020, 4:51pm
2
qarmin:
but sadly each tutorial
Which tutorial? The builds that were once hosted on win32builder.gnome.org were native GTK3 builds for Windows, so they would not help you for cross-compilation. Additionally, we stopped providing native builds for GTK3 years ago.
You need to install the appropriate MINGW cross-compilationpackages for your Linux distribution. Fedora calls them mingw64-gtk3
, while Debian calls them mingw-w64
. For other distributions you will have to ask the appropriate distribution’s support channel.
1 Like
qarmin
(Rafał Mikrut)
October 4, 2020, 7:30pm
3
E.g. - http://www.tarnyko.net/en/?q=node/45
I already setup cross compile based on this tutorial - https://www.reddit.com/r/rust/comments/6rerw5/tutorial_cross_compiling_a_gtk_program_from_linux/
I’m using Ubuntu 20.04
With command PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=x86_64-pc-windows-gnu --bin czkawka_gui
everything compile fine but when linking it shows this errors
rafal@rafalDesktop:~/Pobrane/czkawka$ PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=x86_64-pc-windows-gnu --bin czkawka_gui
Compiling czkawka_gui v1.0.0 (/home/rafal/Pobrane/czkawka/czkawka_gui)
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-m64" "-nostartfiles" "/usr/x86_64-w64-mingw32/lib/crt2.o"
.......
l,-Bdynamic" "-lgtk-3" "-lgdk-3" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-latk-1.0" "-lcairo-gobject" "-lcairo" "-lgdk_pixbuf-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-latk-1.0" "-lgobject-2.0" "-lglib-2.0" "-lgdk-3" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgobject-2.0" "-lglib-2.0" "-lpango-1.0" "-lgobject-2.0" "-lglib-2.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lwinapi_advapi32" "-lwinapi_cfgmgr32" "-lwinapi_credui" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_ole32" "-lwinapi_opengl32" "-lwinapi_secur32" "-lwinapi_shell32" "-lwinapi_user32" "-lwinapi_winmm" "-lwinapi_winspool" "-lwinapi_ws2_32" "-lgobject-2.0" "-lglib-2.0" "-lcairo-gobject" "-lgobject-2.0" "-lglib-2.0" "-lcairo" "-lglib-2.0" "-ladvapi32" "-lws2_32" "-luserenv" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lmsvcrt" "-luser32" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lgcc" "-lmsvcrt" "-lkernel32" "/home/rafal/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o"
= note: /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgtk-3
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk-3
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lpangocairo-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lpango-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lharfbuzz
/usr/bin/x86_64-w64-mingw32-ld: cannot find -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcairo-gobject
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcairo
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk_pixbuf-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgio-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgobject-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lglib-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgobject-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lglib-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk-3
ebassi
(Emmanuele Bassi)
October 4, 2020, 7:34pm
4
That was written 7 years ago. Stuff is bound to go out of date, especially if it’s on a personal blog.
It would have also helped to say you’re trying to build a Rust program—either directly or, better, by using the rust
tag.
You may want to join the #rust
channel on irc.gnome.org ; you can use Matrix as well.
You probably need to set up the LD_LIBRARY_PATH
as well, so that the linker can find the mingw libraries.
qarmin
(Rafał Mikrut)
October 4, 2020, 7:38pm
5
The problem is that I don’t know if I have this libraries.
sudo find / | grep mingw | grep gtk
doesn’t print anything
ebassi
(Emmanuele Bassi)
October 4, 2020, 7:40pm
6
I’m afraid you’ll have to ask on an Ubuntu forum where to find the MINGW binary packages for GTK3.
sdroege
(Sebastian Dröge)
October 5, 2020, 6:07am
7
I don’t think Ubuntu/Debian have binary packages that provide Windows/mingw versions of GTK.
1 Like
ebassi
(Emmanuele Bassi)
October 5, 2020, 11:39am
8
That’s disappointing, but understandable.
I’d recommend using Fedora, given that they do ship packages for cross-compiling GTK3. Alternatively, use a Windows VM to build things and distribute them; Microsoft provides free virtual machine images that you can spin up for development and testing purposes.
1 Like
qarmin
(Rafał Mikrut)
October 5, 2020, 11:46am
9
With Fedora I had problem with compilation my app due to strange error with xkbcommon.
Now finally with copied from msys2 gtk3 lib folder and pointed to it RUSTFLAGS="-L " I’m able to compile my app.
I will create short tutorial on r/rust how to do it step by step
2 Likes
sdroege
(Sebastian Dröge)
October 6, 2020, 7:41am
10
system
(system)
Closed
October 20, 2020, 7:53am
11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.