3

I am trying to generate a .gir-file from a very simple library; it's basically the GObject example from the GLib documentation. When using g-ir-scanner, it fails with the follwing error:

$ g-ir-scanner -I./ --library=foo --library-path=./ --pkg=gobject-2.0 --namespace=Foo -o foo-bar.gir foo-bar.c foo-bar.h
g-ir-scanner: compile: gcc -Wall -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-         linux-gnu/glib-2.0/include -I./ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-  2.0/include -c -o /home/roman/Documents/own_gobject/tmp-introspectEx3pzw/Foo-None.o   /home/roman/Documents/own_gobject/tmp-introspectEx3pzw/Foo-None.c
g-ir-scanner: link: gcc -o /home/roman/Documents/own_gobject/tmp-introspectEx3pzw/Foo-None /home/roman/Documents/own_gobject/tmp-introspectEx3pzw/Foo-None.o -L. -Wl,-rpath=. -  lfoo -L./ -Wl,--export-dynamic -pthread -lgio-2.0 -lgmodule-2.0 -lrt -lgobject-2.0 -lglib-2.0
ERROR: can't resolve libraries to shared libraries: foo

I have really no idea what went wrong. Any ideas?

Dan
  • 1,539
  • 12
  • 23
user2018273
  • 43
  • 1
  • 5

2 Answers2

1

This is a bug in g-ir-scanner (https://bugzilla.gnome.org/show_bug.cgi?id=699442). Basically foo-bar does not contain any GObject classes and it has failed. A class is detected by having a function called foo_blah_get_type().

Robert Ancell
  • 233
  • 3
  • 7
0

the --library argument of g-ir-scanner needs the name of the shared object - for instance, libfoo.so, or libfoo.la if you're using libtool in your build environment.

ebassi
  • 8,648
  • 27
  • 29
  • When I try this I get: "/usr/bin/ld.bfd.real: cannot find -llibfoo.so" So it appears --library should not contain the "lib" or ".so" – Robert Ancell May 02 '13 at 06:49
  • From the man page: -i, --library=LIBRARY Specifies a library that will be introspected. This means that the *_get_type() functions in it will be called for GObject data types. The name of the library should not contain the leading lib prefix nor the ending shared library suffix. – Robert Ancell May 02 '13 at 07:21