This is kind of linked to this question here: GtkD (the Gtk+bindings for the D language) why compile it?
I'm using GtkD with the D programming language on Ubuntu 12.04 and i'm stuck trying to statically link the compiled libs with my program. Once GtkD is compiled there are three libraries
- libgtkd.a
- libgtkdgl.a
- libgtkdsv.a
After doing make install
these are placed into the /usr/local/lib/
folder and the GtkD source is placed inside the /usr/local/includes/d/
folder. I've also compiled the source to *.di
files and placed them in the relevant folders in /usr/local/includes/d/
as the make script doesn't do this by default.
Here's the source i want to compile.
pragma(lib, "/usr/local/lib/libgtkd.a");
import gtk.MainWindow;
import gtk.Label;
import gtk.Main;
void main(string[] args)
{
Main.init(args);
MainWindow win = new MainWindow("Hello World!");
win.setDefaultSize(200, 100);
win.add(new Label("Hello World"));
win.showAll();
Main.run();
}
Here's the compiler command i use:
rdmd -L-ldl hello_world.d
Here's the errors:
/usr/local/lib/libgtkd.a(Loader.o): In function `_D4gtkc6Loader12pLoadLibraryFAyaE4gtkc6Loader4RTLDZPv':
src/gtkc/Loader.d:(.text._D4gtkc6Loader12pLoadLibraryFAyaE4gtkc6Loader4RTLDZPv+0x28): undefined reference to `dlopen'
src/gtkc/Loader.d:(.text._D4gtkc6Loader12pLoadLibraryFAyaE4gtkc6Loader4RTLDZPv+0x31): undefined reference to `dlerror'
/usr/local/lib/libgtkd.a(Loader.o): In function `_D4gtkc6Loader10pGetSymbolFPvAyaZPv':
src/gtkc/Loader.d:(.text._D4gtkc6Loader10pGetSymbolFPvAyaZPv+0x23): undefined reference to `dlsym'
src/gtkc/Loader.d:(.text._D4gtkc6Loader10pGetSymbolFPvAyaZPv+0x2c): undefined reference to `dlerror'
/usr/local/lib/libgtkd.a(Loader.o): In function `_D4gtkc6Loader14pUnloadLibraryFPvZi':
src/gtkc/Loader.d:(.text._D4gtkc6Loader14pUnloadLibraryFPvZi+0x9): undefined reference to `dlclose'
collect2: ld returned 1 exit status
--- errorlevel 1
shell returned 1
Any ideas what i'm doing wrong? It looks like an ld error but that's linked right?