I want to use the gtk
crate to write a small gui application for Windows. I was wondering if there is any chance I can cross-compile it from my Linux machine to Windows.
When I try to compile my code against the x86_64-pc-windows-gnu
target with PKG_CONFIG_SYSROOT_DIR=/usr/x86_64-w64-mingw32 cargo build --target x86_64-pc-windows-gnu
, I get the following error:
error: linking with `x86_64-w64-mingw32-gcc` failed: exit status: 1
|
[...]
= note: /usr/bin/x86_64-w64-mingw32-ld: cannot find -lgobject-2.0
/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
/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 -lgdk_pixbuf-2.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 -lgobject-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lglib-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lpango-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 -lharfbuzz
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk_pixbuf-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 -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 -lcairo-gobject
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcairo
/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 -lgobject-2.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lglib-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
collect2: error: ld returned 1 exit status
This seems like I'm missing the gtk library files for Windows, but I'm not sure what I should do or how I would get those.
I managed to compile it by using this awesome tool.
Basically it is dockerized Linux Fedora with all necessary dependencies pre-installed.