Closed xanathar closed 3 years ago
This means that we should ignore these constants from the .gir file and instead point at libc::AF_INET
etc. manually.
We already do similar things in https://github.com/gtk-rs/sys/blob/master/glib-sys/src/manual.rs for example.
Do you want to provide a PR for this?
Sure! I just needed this pointer :)
Ignoring can be done via the Gir.toml
file btw :)
This issue involves many repos (sys, gio, and gir-files), so I'm not 100% sure this is the correct one to open the issue to. I've tried to solve the issue, but could not find a similar case to copy so, in case, guidance is needed.
TL;DR: The value of the constant
gio_sys::G_SOCKET_FAMILY_IPV6
is operating system dependent, and so code using it (directly or indirectly) fails on non-Linux OSs (Linux is safe because gir files are generated from Ubuntu's .debs).Repro/Symptom
Running a simple code like:
fails on MacOS (and Windows) with the following output:
on the other hand the following works (on MacOS):
Root cause
SocketFamily::Ipv6
is defined to be the same value (via theto_glib
method) ofgio_sys::G_SOCKET_FAMILY_IPV6
gio_sys::G_SOCKET_FAMILY_IPV6
has a fixed value of10
in https://github.com/gtk-rs/gir-files/blob/master/Gio-2.0.girlibgirepository1.0.*.deb
package of Ubuntu and the original glib sources.glib/glibconfig.h.in
as a constant coming from mesonmeson.build
it seems that it takes the value from theAF_INET6
constant from system includesAF_INET6
is defined as10
on Linux (at least, Ubuntu), as30
on MacOS and as23
on Windows (found by inspecting system SDK header files)