Closed gavr123456789 closed 4 years ago
g-ir-scanner: link: /bin/sh ../libtool --mode=link --tag=CC gcc -o "/home/gavr/bin/Git Builds install/gtknodes/introspection/tmp-introspectfbhpl2t6/GtkNodes-0.1" -export-dynamic -g -O2 "/home/gavr/bin/Git Builds install/gtknodes/introspection/tmp-introspectfbhpl2t6/GtkNodes-0.1.o" -L. ../src/libgtknodes-0.1.la -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lglib-2.0
libtool: link: gcc -o /home/gavr/bin/Git Builds install/gtknodes/introspection/tmp-introspectfbhpl2t6/.libs/GtkNodes-0.1 -g -O2 /home/gavr/bin/Git Builds install/gtknodes/introspection/tmp-introspectfbhpl2t6/GtkNodes-0.1.o -Wl,--export-dynamic -pthread -Wl,--export-dynamic -L. ../src/.libs/libgtknodes-0.1.so -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -pthread
gcc: error: Builds: No such file or directory
gcc: error: install/gtknodes/introspection/tmp-introspectfbhpl2t6/.libs/GtkNodes-0.1: No such file or directory
gcc: error: /home/gavr/bin/Git: No such file or directory
gcc: error: Builds: No such file or directory
gcc: error: install/gtknodes/introspection/tmp-introspectfbhpl2t6/GtkNodes-0.1.o: No such file or directory
linking of temporary binary failed: Command '['/bin/sh', '../libtool', '--mode=link', '--tag=CC', 'gcc', '-o', '/home/gavr/bin/Git Builds install/gtknodes/introspection/tmp-introspectfbhpl2t6/GtkNodes-0.1', '-export-dynamic', '-g', '-O2', '/home/gavr/bin/Git Builds install/gtknodes/introspection/tmp-introspectfbhpl2t6/GtkNodes-0.1.o', '-L.', '../src/libgtknodes-0.1.la', '-lgio-2.0', '-lgobject-2.0', '-Wl,--export-dynamic', '-lgmodule-2.0', '-pthread', '-lglib-2.0', '-lglib-2.0']' returned non-zero exit status 1.
make[1]: *** [/usr/share/gobject-introspection-1.0/Makefile.introspection:156: GtkNodes-0.1.gir] Error 1
make[1]: выход из каталога «/home/gavr/bin/Git Builds install/gtknodes/introspection»
make: *** [Makefile:464: all-recursive] Error 1
Cant compile now, did it works for you?
afaik POSIX make does not allow white spaces in $srcdir variables, but most of the time it appears to work (until it doesn't). You build in a "Git Builds" subdirectory, so this would be the source of the error. If it worked before, it was likely because I did the introspecting in the src/ directory, which may have resulted in relative paths. I don't see a way to work around the white space restriction while the build is using autotools, but I can have a look whether there is a macro which at least warns if a path is unsafe.
ok, so LT_INIT warns about this already by default, but it's not very visible in the configure output...
Renamed to Git_Builds_install
and it works now, ty.
I never thought that I would face the problem of spaces in names again, after I left Windows.
Run-time dependency gtknodes found: YES 0.1
Build targets in project: 1
Found ninja-1.10.0 at /usr/bin/ninja
[1/3] Compiling Vala source ../v.vala
FAILED: exec@exe/v.c
valac -C --debug --debug --pkg gtknodes --pkg gxml-0.20 --pkg libvala-0.48 --pkg granite --pkg libdazzle-1.0 --pkg gpseq-1.0 --pkg json-glib-1.0 --pkg gtk+-3.0 --pkg gee-0.8 --pkg gobject-2.0 --pkg glib-2.0 --color=always --directory exec@exe --basedir ../ ../v.vala
error: Package `gtknodes' not found in specified Vala API directories or GObject-Introspection GIR directories
Compilation failed: 1 error(s), 0 warning(s)
ninja: build stopped: subcommand failed.
Looks like something wrong with name. Maybe it should be something along with the version or it should match vapi libgtknodes.
(Now its just gtknodes)
Most people seem to use the version in the name
The issue was that the vapi generator takes header names from the introspection file, which are not the proper c includes. Should be fixed now.
I don't know vala, so I've only come up with the quick and simple demo code below, it compiles with
valac --pkg gtknodes demo.vala && ./demo
It really doesn't do much obviously, as I does not implement the actual transport mechanism between the sockets.
using Gtk;
using GtkNodes;
static void node_connected(Widget socket, Widget source, Label lbl)
{
lbl.label = "connected";
}
static void node_disconnected(Widget socket, Widget source, Label lbl)
{
lbl.label = "disconnected";
}
int main (string[] args) {
Gtk.init (ref args);
var window = new Window ();
window.title = "Nodes Demo";
window.border_width = 10;
window.window_position = WindowPosition.CENTER;
window.set_default_size (300, 300);
window.destroy.connect (Gtk.main_quit);
var node_view = new GtkNodes.NodeView();
var node = new GtkNodes.Node();
node.set_label("Demo");
var ilbl = new Gtk.Label("Input");
ilbl.set_xalign(0.0f);
var input = node.item_add(ilbl, GtkNodes.NodeSocketIO.SINK);
GLib.Signal.connect(input, "socket-connect", (GLib.Callback) node_connected, ilbl);
GLib.Signal.connect(input, "socket-disconnect", (GLib.Callback) node_disconnected, ilbl);
var olbl = new Gtk.Label("Output");
olbl.set_xalign(1.0f);
node.item_add(olbl, GtkNodes.NodeSocketIO.SOURCE);
node_view.add(node);
window.add(node_view);
window.show_all();
Gtk.main();
return 0;
}
Nice, all works for me now!
Also Vala use native signals, and Im not sure how to rewrite your example.(Its fun to see that C variant also works)
It looks like input has no "socket-connect" signal:
But node has some "node_socket_connect"
Im not about this difference in names, anyway it works, also here vala signals docs.
Also, here you can look at same target project(but on Vala), if you intrested.
I was irritated by the signal issue as well, that's why I went with GLib.Signal.connect(). The socket_connect() call is present in the introspection bindings, at least in python, so I suppose this is specific to the Vala bindings. I guess this stems from the fact, that all socket widgets are (intentionally) returned as GtkWidget with node.item_add(). I'll try and figure out why that is and how to work around that.
I think I have figured it out. The returned sockets require a cast to (GtkNodes.NodeSocket), otherwise valac will complain about the signal not existing in the Gtk.Widget context. Then you can use item.signal.connect() as expected.
I'll add the code below to the repository as a very basic demonstrator.
using Gtk;
using GtkNodes;
int main (string[] args)
{
Gtk.init (ref args);
var window = new Window ();
window.title = "Nodes Demo";
window.border_width = 10;
window.window_position = WindowPosition.CENTER;
window.set_default_size (300, 300);
window.destroy.connect (Gtk.main_quit);
var node_view = new GtkNodes.NodeView();
var node = new GtkNodes.Node();
node.set_label("Demo");
var ilbl = new Gtk.Label("Input");
ilbl.set_xalign(0.0f);
unowned var input = (GtkNodes.NodeSocket) node.item_add(ilbl, GtkNodes.NodeSocketIO.SINK);
input.socket_connect.connect (() => {
ilbl.label = "connected";
});
input.socket_disconnect.connect (() => {
ilbl.label = "disconnected";
});
var olbl = new Gtk.Label("Output");
olbl.set_xalign(1.0f);
node.item_add(olbl, GtkNodes.NodeSocketIO.SOURCE);
node_view.add(node);
window.add(node_view);
window.show_all();
Gtk.main();
return 0;
}
added, but not tested for actual functionality