Rust bindings for Tracker 3 from Gir

I’m following the gtk-rs gir tutorial to create bindings for Tracker 3 and I am getting an error after following the step.

> rm Cargo.* # we remove Cargo files
> gir -m sys -d ../../gir-files/
> cargo build

I had to add <package name=“tracker-sparql-3.0”/> to the Tracker-3.0.gir file.
When I run the commands above it cannot find the pkg-config because it is using the wrong name. It should be tracker-sparql-3.0 but the error messages says
Package tracker_sparql_3_0 was not found in the pkg-config search path.

Looking at the generated file /tests/abi.rs
The PACKAGES is written correctly, so I don’t know why, when the pkg_config_cflags is run it is replacing the punctuation with _

Does someone know more why this is happening?

p.s. I got the tracker gir file from /usr/share/gir-1.0/ on Fedora 33 and the other girs from the gtk-rs/gir-files.

Can you create an issue against gir for that? This needs some further debugging with the .gir file and what happens there inside gir.

That you had to manually add the package to the .gir file suggests that it’s kind of broken though and that will have to be fixed on the tracker side.

Thanks @sdroege, I’ll write an issue in the morning.

Hi, IIRC the Tracker library is mostly just a wrapper around the D-Bus interface. If that is (still) the case and you can’t make this work, you might also want to consider talking to D-Bus directly. You can use our crate, zbus for that.

2 Likes

This usually means that the invocation of g-ir-scanner isn’t complete on the Tracker side; and, indeed:

tracker_sparql_gir = gnome.generate_gir(libtracker_sparql,
    sources: libtracker_sparql_c_sources + libtracker_sparql_c_public_headers,
    nsversion: tracker_api_version,
    namespace: 'Tracker',
    identifier_prefix: 'Tracker',
    symbol_prefix: 'tracker',
    includes : ['GLib-2.0', 'GObject-2.0', 'Gio-2.0' ],
    link_with: libtracker_sparql,
    install: true,
    extra_args: [
        '--c-include',
        'libtracker-sparql/tracker-sparql.h',
        '-DTRACKER_COMPILATION',
    ])

at: src/libtracker-sparql/meson.build · master · GNOME / tracker · GitLab is missing a:

export_packages: 'tracker-sparql-3.0'

in the arguments list.

Please, file a bug against Tracker.

Thanks for making this an easy fix :slight_smile: https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/351

@dean, I’m excited to talk to see Rust talking to Tracker soon!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.