GNOME Bugzilla – Bug 706906
Ambiguous error messages when shared library not found
Last modified: 2017-05-21 22:47:15 UTC
Today I encountered: "Error: Unsupported type void, deriving from fundamental void" I had created a minimal GObject in Vala and generated the typelib and tried to construct it in Javascript via gjs. Eventually I realised that shared-library wasn't specified in the .gir file (and thus .typelib) as I had generated it with valac. Upon specifying it (using "g-ir-compiler --shared-library=blah"), everything worked. So, I suppose gjs knows of the entities through the .typelib. Is it possible for it to know that it doesn't have definitions for it (unable to link with the library) and report that, rather than waiting until you try to use the code and balking at 'void' types?
This is due basically to a total lack of error handling during imports =/ One bit does throw a GError but then it gets silently eaten at a higher level in importer.c, and there are many functions which don't properly handle errors.
Richard, would you be able to provide a simple test case? (Or otherwise check if the bug is fixed now...) I can't seem to get this to break in the way you described, though I'm fairly sure it's still an issue as I talked to someone on IRC just a few weeks ago who had the same problem. My effort to reproduce this was as follows: Minimal Foo-0.gir created with valac: <?xml version="1.0"?> <repository version="1.2" xmlns="http://www.gtk.org/introspection/core/1.0" xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0"> <package name="foo"/> <namespace name="Foo" version="0" c:prefix="Foo"> <function name="hello" c:identifier="foo_hello"> <return-value transfer-ownership="full"> <type name="none"/> </return-value> <parameters> <parameter name="greeting" transfer-ownership="none"> <type name="utf8" c:type="const gchar*"/> </parameter> </parameters> </function> </namespace> </repository> To create Foo-0.typelib: g-ir-compiler Foo-0.gir -o Foo-0.typelib To run GJS: GI_TYPELIB_PATH=. gjs -c 'imports.gi.Foo.hello' Output: (gjs:30441): Gjs-WARNING **: JS ERROR: GLib.Error g-invoke-error-quark: Could not locate foo_hello: 'foo_hello': dlsym(RTLD_DEFAULT, foo_hello): symbol not found JS_EvaluateScript() failed This seems a reasonable error message to me, and is unlike the one that you (and the other person on IRC) described.
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment. Thanks!