gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
236 stars 107 forks source link

thread 'main' panicked at 'Package name doesn't exist' #885

Closed SelectSweet closed 4 years ago

SelectSweet commented 4 years ago

Hello, Ive been trying to generate a Gegl binding by following the tutorial on the website but Ive run into an issue that is similar to this one where the compiler panics about something to do with options

Error output:


[ERROR libgir::library_postprocessing] Field `BufferIterator::items` is missing c:type
[ERROR libgir::library_postprocessing] Field `Lookup::table` is missing c:type
[WARN  libgir::library_postprocessing] Field `AudioFragment::data` missing c:type assumed to be `fixed_array`
[WARN  libgir::library_postprocessing] Field `BufferMatrix2::coeff` missing c:type assumed to be `fixed_array`
[WARN  libgir::library_postprocessing] Field `Lookup::bitmask` missing c:type assumed to be `fixed_array`
[WARN  libgir::library_postprocessing] Field `Matrix3::coeff` missing c:type assumed to be `fixed_array`
[WARN  libgir::library_postprocessing] Field `PathItem::point` missing c:type assumed to be `fixed_array`
[WARN  libgir::library_postprocessing] Field `TileSource::padding` missing c:type assumed to be `fixed_array`
[WARN  libgir::library_postprocessing] Field `TileSourceClass::padding` missing c:type assumed to be `fixed_array`
[WARN  libgir::library_postprocessing] Field `TileBackendClass::padding` missing c:type assumed to be `fixed_array`
thread 'main' panicked at 'Package name doesn't exist', src/libcore/option.rs:1185:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Gir.toml

[options]
library = "Gegl"
version = "0.4"
target_path = "."
min_cfg_version = "0.4"
work_mode = "sys"
girs_dir = "gir-files/"

external_libraries = [
    "GLib",
    "GObject",
    "Babl",
]
EPashkin commented 4 years ago

@SelectSweet Thanks for report. Can you provide your Gegl.gir, seems it don't have package tag? Paniced this part of code

        ns.package_name
            .as_ref()
            .expect("Package name doesn't exist")
SelectSweet commented 4 years ago

Here is my Gegl.gir

https://gist.github.com/SelectSweet/ea812d1e8cbfd138b08a56e56762af68

EPashkin commented 4 years ago

Try adding package tag:

<include name="GObject" version="2.0"/>
<package name="gegl"/>
<c:include name="gegl.h"/>
EPashkin commented 4 years ago

This not work without "babl-0.1.gir" 😢

EPashkin commented 4 years ago

https://github.com/nemequ/vala-girs/blob/master/gir-1.0/Babl-0.1.gir works after adding package

  <package name="babl"/>
  <c:include name="babl.h"/>
sdroege commented 4 years ago

This is a bug in the build system of the C library, it should provide the name of the pkg-config package when calling the gobject-introspection tools.

SelectSweet commented 4 years ago

i thought this might have been the case as it outputted a pkg-config error after i added the bits suggested, changing the name value to the gegl pkg-config name fixed the problem

<package name="gegl-0.4"/>
<c:include name="gegl.h"/>
SelectSweet commented 4 years ago

thank you, for the assistance