Sign up

Pages: 1 2

Re: GtkD, Dub, and being dynamic

On Wed, 16 Mar 2016 08:29:11 +0100, Saša Janiška wrote:
[…]

Ahh, that's not practical then (for now), so it remains to be heard from
Russel in regard to SCons vs dub.

Given that I maintain the D support in SCons, I could be considered a very biased observer!

Clearly though for builds requiring dependencies, Dub is the right way forward, even though it needs a lot of work to be up to the level of Cargo or Gradle (*). Where there are no dependencies, as here for me where I build my own GtkD, I will always use SCons: Dub puts compilation products for dependencies in all the wrong places from what I can see, and it appears not so discerning as SCons (and Make) determining what to compile and what not to compile, and indeed how to compile.

(*) Gradle has C and C++ build capability, it would be good if it had D capability, probably wouldn't need Dub then.

Re: GtkD, Dub, and being dynamic

On Thu, 24 Mar 2016 00:31:49 GMT, Jean-Baptiste Lab wrote:

I'm successfully using DUB with the http://d-apt.sourceforge.net/ GtkD debian packages which contain a shared version of GtkD.
It's nice as it produces smaller executables and links a hell of a lot quicker on my slow machine.
There's a caveat though: DUB needs to be fixed to handle some pkg-config issues. The good news is that my PR for exactly this has been accepted and merged, so you can either build DUB from github and get going or wait for a release...

I'm fooling around with this myself and not having much luck. I cloned dub from github to pickup your PR and I have installed the GtkD libraries from Arch which seems to have installed them correctly and setup the pkg-config as well. My dub.json file appears as follows:

{
	"name": "terminix",
	"description": "A VTE based terminal emulator for Linux",
	"copyright": "Copyright © 2015, Gerald Nunn",
	"authors": ["Gerald Nunn"],
    "dependencies": {
		"gtk-d": "3.2.3"
	},
    "libs": ["gtkd-3"],
    "lflags": ["-defaultlib=gtkd-3.so"],
	"buildTypes": {
		"release": {
            "versions": ["StdLoggerDisableTrace"]
		},
        "localize": {
            "versions": ["Localize"]
        }
	}    
}

When build the application with dub it is indeed smaller, about 4 MB versus 12 MB, however running the application gives me a bunch of errors:

(terminix:16759): Gtk-CRITICAL **: gtk_window_set_application: assertion 'GTK_IS_WINDOW (window)' failed

(terminix:16759): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(terminix:16759): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

If I run ldd on the executable it looks correct:

	linux-vdso.so.1 (0x00007fff3ace6000)
	libgtkd-3.so.0 => /usr/lib/libgtkd-3.so.0 (0x00007f3b0765b000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f3b07457000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f3b0723a000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f3b06f35000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f3b06d2d000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f3b06b17000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f3b06776000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f3b0878a000)
	libphobos2.so.0.70 => /usr/lib/libphobos2.so.0.70 (0x00007f3b05f5d000)

Any idea what I'm doing wrong? Can you post an example of your dub.json?

Re: GtkD, Dub, and being dynamic

Ignore my last, it seems to be working now though I'm not sure why, weird.

Re: GtkD, Dub, and being dynamic

Just curious if anyone's found much difference in compile times between static and dynamic linking? I tested this a bit using my terminix application and the compile times for static and dynamic linking were about the same, around 9 seconds on my laptop. The size of the executable was much smaller using dynamic linking but disappointingly no real difference in compile times.

Re: GtkD, Dub, and being dynamic

On Sun, 27 Mar 2016 16:47:05 GMT, Gerald Nunn wrote:

Just curious if anyone's found much difference in compile times between static and dynamic linking? I tested this a bit using my terminix application and the compile times for static and dynamic linking were about the same, around 9 seconds on my laptop. The size of the executable was much smaller using dynamic linking but disappointingly no real difference in compile times.

I experience much shorter compile/link times using dynamic linking on my home machine, which is quite old (Dual core, standard HDD, 4G of RAM). On my work laptop (quad core, SSD, 8G of RAM), it doesn't make much of a difference, but the resulting executable is much smaller. If you compile in release mode and strip the executable, it gets actually quite small, almost acceptable ;)

JB

Re: GtkD, Dub, and being dynamic

On Sat, 26 Mar 2016 02:04:57 GMT, Gerald Nunn wrote:

On Thu, 24 Mar 2016 00:31:49 GMT, Jean-Baptiste Lab wrote:

I'm successfully using DUB with the http://d-apt.sourceforge.net/ GtkD debian packages which contain a shared version of GtkD.
It's nice as it produces smaller executables and links a hell of a lot quicker on my slow machine.
There's a caveat though: DUB needs to be fixed to handle some pkg-config issues. The good news is that my PR for exactly this has been accepted and merged, so you can either build DUB from github and get going or wait for a release...

I'm fooling around with this myself and not having much luck. I cloned dub from github to pickup your PR and I have installed the GtkD libraries from Arch which seems to have installed them correctly and setup the pkg-config as well. My dub.json file appears as follows:

{
	"name": "terminix",
	"description": "A VTE based terminal emulator for Linux",
	"copyright": "Copyright © 2015, Gerald Nunn",
	"authors": ["Gerald Nunn"],
    "dependencies": {
		"gtk-d": "3.2.3"
	},
    "libs": ["gtkd-3"],
    "lflags": ["-defaultlib=gtkd-3.so"],
	"buildTypes": {
		"release": {
            "versions": ["StdLoggerDisableTrace"]
		},
        "localize": {
            "versions": ["Localize"]
        }
	}    
}

You shouldn't need to list gtk-d as a dub dependency anymore, nor should the "lflags": ["-defaultlib=gtkd-3.so"] be necessary (this will be taken care of by dub invoking pkg-config --libs gtkd3 correctly).
However, you may need to add a "importPaths" : ["/usr/include/dmd/gtkd3"] for the compiler to find the GtkD files, depending on where the Arch package install those and whether your dmd.conf has an entry pointing to the GtkD files...

When build the application with dub it is indeed smaller, about 4 MB versus 12 MB, however running the application gives me a bunch of errors:

(terminix:16759): Gtk-CRITICAL **: gtk_window_set_application: assertion 'GTK_IS_WINDOW (window)' failed

(terminix:16759): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(terminix:16759): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

If I run ldd on the executable it looks correct:

	linux-vdso.so.1 (0x00007fff3ace6000)
	libgtkd-3.so.0 => /usr/lib/libgtkd-3.so.0 (0x00007f3b0765b000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f3b07457000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f3b0723a000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f3b06f35000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f3b06d2d000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f3b06b17000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f3b06776000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f3b0878a000)
	libphobos2.so.0.70 => /usr/lib/libphobos2.so.0.70 (0x00007f3b05f5d000)

Any idea what I'm doing wrong? Can you post an example of your dub.json?

Pages: 1 2