Linux, Mono-D, GtkD and linking

Bad Sector via Digitalmars-d-ide digitalmars-d-ide at
Fri Aug 29 03:32:38 PDT 2014

Hi all,

I'm trying to evaluate D for my uses (games and game tools 
development) and see how it compares to my current languages (C 
for engine, Lazarus/FreePascal for tools at home and C++ for 
engine and tools at work). For now it is me trying to see how it 
fares and maybe switching to it for my own stuff at the beginning.

However i have already stumbled on a very fundamental issue: i 
cannot convince DMD to compile and link a GtkD program under 

I'm using Ubuntu so MonoD seems to be the best solution so far, 
even if the MonoDevelop environment feels very out of place under 
Ubuntu/Unity (i also tried DDT for Eclipse since i used Eclipse 
at the past, but DDT was freezing constantly and it didn't had 
good auto completion support).

I want to have a setup where i can have a few shared libraries (a 
core library, a rendering library, a utility library) and two 
applications (the editor and the engine which will work with data 
produced by the editor - note that unlike some popular engines, i 
prefer to keep these two as separate as possible), one with GC 
enabled (the editor) and one with GC disabled (engine). Both need 
to link against Derelict (for the OpenGL API and SDL2 for the 
engine) and the editor needs to link against GtkD (for its UI).

For starters i tried to use DUB, but i quickly found out that 
Mono-D tries to import all projects that the dependencies expose 
(so i had one project - my initial test - and 10+ projects i 
didn't care looking at). In addition no settings about the 
project layout seemed to be saved (i made an "External" solution 
folder to put all the GtkD and Derelict projects inside to not 
occupy visual space, but once i reopened the projec in 
MonoDevelop, the folder wasn't there). Finally just having all 
the projects there seemed to slow down MonoDevelop considerably. 
So i decided to drop DUB, at least for development purposes, and 
use Mono-D's building functionality.

Mono-D by itself provides much more organization options and 
feels mostly fine (i still dislike MonoDevelop forcing its own 
theme on me, but i can live with that). However i have several 
issues with its own builder.

First of all, i had to add all the DUB includes and libraries for 
GtkD and Derelict manually in the global includes and libraries 
settings in order for the syntax completion to discover them, 
despite having them being part of DUB (i expected since i have 
DUB installed and configured that Mono-D will see it 
automatically... or at least provide some configuration options 
to choose which of the installed DUB projects i want to use). 
Note that i added these in the global settings to avoid placing 
anything platform-specific in the project's own settings since 
i'll want to test and compile the project under Windows and OS X 

However even with the libraries and includes configured, i had 
linker errors with "dlsym" and "dlerror" missing, which seem to 
come from the libdl. After googling for a while to find how to 
fix that, i managed to make it work by adding 'version(Posix) 
pragma (lib, "dl");' at the top of my test code.

This worked, but i quickly discovered that building and linking 
is *terribly slow*. One of the reasons i like C is that it has 
very fast compilation and compilation speed is important for my 
workflow. However even C++, which i generally avoid with one of 
the reasons being compilation speed, compiles much faster. Note 
that my computer only has SSD so I/O performance shouldn't be the 

I noticed that Mono-D's settings have a single step compilation 
mode, which *may* have to do with this. I tried to disable it but 
then i got back the dlsym errors. I tried to put a -L-ldl in 
almost every possible place in the settings (both global and 
project) but nothing seemed to work. I cannot make the program 
link against the library. Also considering that my test program 
is still only a single file (i'm just trying out GtkD for now) 
and i read in an old post that pragma lib doesn't propagate to 
other files, it sounds that this wouldn't work with my intended 
setup anyway.

So at this point i'm not sure how to continue. TBH what i'd like 
is to be able to have Mono-D provide me with a nice UI to select 
DUB dependencies without fussing with library paths, linker 
flags, etc (unless i want to add some extra flags for 
optimization or debugging, of course) and use DUB behind the 
scenes by itself (and keep the DUB file around so i can build the 
project without having Mono-D installed in another D installation 
and/or operating system) but without polluting my project tree 
with external things i didn't explicitly add (i don't consider 
dependencies something i explicitly added, especially when said 
dependencies - like Derelict - add a ton of things i don't even 
plan using).

Is there any tips, suggestions or any other help for the above?

More information about the Digitalmars-d-ide mailing list