gtk-rs / gtk3-rs

Rust bindings for GTK 3
https://gtk-rs.org
MIT License
508 stars 90 forks source link

[BUG] Broken cross-compilation for Windows in gtk-rs 0.15.1 #727

Closed qarmin closed 2 years ago

qarmin commented 2 years ago

Bug description

Looks that updating gtk3-rs version in my app(from 0.14 to 0.15) broke cross-compilation from Ubuntu 20.04 to Windows

PR - https://github.com/qarmin/czkawka/pull/583 CI - https://github.com/qarmin/czkawka/runs/4992939016?check_suite_focus=true

probably this is caused by using new functions(but strange that this works fine on Ubuntu)

  = note: /usr/bin/x86_64-w64-mingw32-ld: /home/runner/work/czkawka/czkawka/target/x86_64-pc-windows-gnu/release/deps/libgtk-666415928b473153.rlib(gtk-666415928b473153.gtk.f8e75567-cgu.12.rcgu.o):gtk.f8e75567-cgu.1:(.text+0x10931): undefined reference to `gtk_file_chooser_widget_accessible_get_type'
          /usr/bin/x86_64-w64-mingw32-ld: /home/runner/work/czkawka/czkawka/target/x86_64-pc-windows-gnu/release/deps/libgtk-666415928b473153.rlib(gtk-666415928b473153.gtk.f8e75567-cgu.12.rcgu.o):gtk.f8e75567-cgu.1:(.text+0x10a2d): undefined reference to `gtk_file_chooser_widget_accessible_get_type'
          /usr/bin/x86_64-w64-mingw32-ld: /home/runner/work/czkawka/czkawka/target/x86_64-pc-windows-gnu/release/deps/libgtk-666415928b473153.rlib(gtk-666415928b473153.gtk.f8e75567-cgu.12.rcgu.o):gtk.f8e75567-cgu.1:(.text+0x10a71): undefined reference to `gtk_file_chooser_widget_accessible_get_type'
          /usr/bin/x86_64-w64-mingw32-ld: /home/runner/work/czkawka/czkawka/target/x86_64-pc-windows-gnu/release/deps/libgtk-666415928b473153.rlib(gtk-666415928b473153.gtk.f8e75567-cgu.12.rcgu.o):gtk.f8e75567-cgu.1:(.text+0x10a8d): undefined reference to `gtk_file_chooser_widget_accessible_get_type'
          /usr/bin/x86_64-w64-mingw32-ld: /home/runner/work/czkawka/czkawka/target/x86_64-pc-windows-gnu/release/deps/libgtk-666415928b473153.rlib(gtk-666415928b473153.gtk.f8e75567-cgu.8.rcgu.o):gtk.f8e75567-cgu.8:(.text+0x4e09): undefined reference to `gtk_file_chooser_widget_accessible_get_type'
          collect2: error: ld returned 1 exit status

Basing on this change (search for gtk_file_chooser_widget_accessible_get_type in file), new function was introduced in 3.24.30 https://github.com/clearlinux-pkgs/gtk3/commit/10270d5df941d9a33a70c9c4c78fb69a7f588321

In Cargo toml I use features = ["v3_24_9"], so this should work fine.

sdroege commented 2 years ago

This was added in 1a64d130b9f8. GTK added this in https://gitlab.gnome.org/GNOME/gtk/-/commit/50cbb8f9a2436eb4abbaadb88d2bf90e2ae0ca53 , which exists since 3.24.30 but misses Since markers for the version.

Should override that here to only make it available in 3.24.30 and above.

sdroege commented 2 years ago

Upstream fix here: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4425

Going to work around it locally for now.

sdroege commented 2 years ago

See https://github.com/gtk-rs/gtk3-rs/pull/728 , will also backport that to 0.15 once it's merged and make a bugfix release. Thanks for reporting!