Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Cross compiling of gtk-rs project from linux to windows failing #437

Open
fightthepower opened this issue Apr 11, 2021 · 5 comments
Open
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@fightthepower
Copy link

fightthepower commented Apr 11, 2021

I have read preparing rust tutorial and I have followed all the steps , including a additional step recommended by this stack overflow answer rustup toolchain install stable-x86_64-pc-windows-gnu


rustup target add x86_64-pc-windows-gnu
rustup toolchain install stable-x86_64-pc-windows-gnu
cargo build --target x86_64-pc-windows-gnu
sudo apt-get install mingw-w64

But when compiling its failing at the last stage with this error

error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1

 = 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 -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 -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 -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 -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 -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 -lgobject-2.0
          /usr/bin/x86_64-w64-mingw32-ld: cannot find -lglib-2.0
          /usr/bin/x86_64-w64-mingw32-ld: cannot find -lglib-2.0
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error; 2 warnings emitted

error: could not compile `project`

OS : Linux (Ubuntu)
rustc : 1.50.0
gtk-rs : 0.9.2 (features version 3_22, same as the host trying to compile)

@sdroege
Copy link
Member

sdroege commented Apr 11, 2021

Do you have Windows versions of the GTK libraries and its dependencies installed and their pkg-config file visible to the environment where you're building your code?

@fightthepower
Copy link
Author

fightthepower commented Apr 11, 2021

Sorry I didn't know that we have to install these as well.

pacaur -S mingw-w64-gcc mingw-w64-freetype2-bootstrap mingw-w64-cairo-bootstrap
pacaur -S mingw-w64-harfbuzz
pacaur -S mingw-w64-pango
pacaur -S mingw-w64-poppler
pacaur -S mingw-w64-gtk3

I thought it would be automatically added with sudo apt-get install mingw-w64. It looks like in ubuntu there is no sudo apt install way to install those packages. Anyhow I found another tutorial where they cross compiled gtk-rs using docker. I tried to repeat the same with there docker but while building the image at here ADD package.sh /usr/bin/package.sh it crashes.

Is there any other docker images or files which do the same thing?

@bilelmoussaoui bilelmoussaoui added documentation Improvements or additions to documentation question Further information is requested labels Apr 12, 2021
@MGlolenstine
Copy link

@fightthepower: Have you tried compiling it using this docker container?
I've used it before and it does run well.

@fightthepower
Copy link
Author

fightthepower commented May 28, 2021

@MGlolenstine Yes I tried with rust-crosscompile but sadly there is some issue with one of my dependency "rusqlite". I have reported that issue but sofar nothing.

@MGlolenstine
Copy link

Can you try with sqlite-bundled feature? https://github.com/rusqlite/rusqlite

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants