After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706906 - Ambiguous error messages when shared library not found
Ambiguous error messages when shared library not found
Status: RESOLVED INCOMPLETE
Product: gjs
Classification: Bindings
Component: general
1.36.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2013-08-27 17:37 UTC by Richard Schwarting
Modified: 2017-05-21 22:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Richard Schwarting 2013-08-27 17:37:00 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?
Comment 1 Colin Walters 2013-10-15 22:13:16 UTC
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.
Comment 2 Philip Chimento 2017-01-02 01:29:59 UTC
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.
Comment 3 Philip Chimento 2017-05-21 22:47:15 UTC
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!