FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Convert the gtkD source files

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
nazarel



Joined: 01 May 2009
Posts: 8
Location: Houston

PostPosted: Fri May 01, 2009 7:59 pm    Post subject: Convert the gtkD source files Reply with quote

How do you convert the gtkD source files into a shared object or other type of library file?

I'm trying to write an example code for gtkD and trying to compile it in Code::Blocks IDE. I've read the documentation on CodeBlocks, and it says I need to add the library file in the linker settings. The file types it accepts are .a, .so, .lib, .dylib, and .bundle - how do I convert the gtkD source files into one of these file formats?

Any help would be appreciated!

(I've already tried searching the fourms, but I can't find the right info).
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Sat May 02, 2009 5:03 am    Post subject: Reply with quote

You can build the library with DSSS by executing the following from the GtkD folder.

Code:
$ dsss build


this will create a bunch of *.a (linux) or *.lib (windows) files you can use.
Also see: http://www.dsource.org/projects/gtkd/wiki/BuildingWithDSSS

Alternatively there is a makefile for Linux and Mac. executing:

Code:
$ make


Will build a static libraries for GtkD, GtkDGL and Sourceview, that you can use.

Optionally you can install the libraries with:

Code:
# dsss install

or
Code:
# make install


This will put the libraries and the source in /usr/local/ this isn't always needed as you can point Codeblocks to the files where they are without installing.
Back to top
View user's profile Send private message
nazarel



Joined: 01 May 2009
Posts: 8
Location: Houston

PostPosted: Sat May 02, 2009 11:21 am    Post subject: got the libgktd.a installed Reply with quote

I ran make and (sudo) make install and I got the libgtkd.a installed within usr/local/lib. I pointed Code::Blocks to libgtkd.a under the Project > Build Options > Linker Settings. I then added the d folder ( under usr/local/gtkD/include/d ) to the Project > Build Options > Search Directories > Compiler, Linker, and Resource Compiler tabs. However when I build the project (hello.d) in Code::Blocks - it gives me these errors:

Code:
Loader .d: (.text+0x54) Undefined reference to 'dlsym'
Loader .d ... Undefined reference to 'dlerror'
Loader .d ... Undefined reference to 'dlopen'
Loader .d ... Undefined reference to 'dlclose'


Here's the code for the project I'm trying to build (it's from the gtkD Dsource examples):

Code:

import gtk.MainWindow;
import gtk.Label;
import gtk.Main;

void main(char[][] args)
{
   Main.init(args);
   MainWindow win = new MainWindow("Hello World");
   win.setDefaultSize(200, 100);
   win.add(new Label("Hello World"));
   win.showAll();

   Main.run();
}


Thanks for the help getting the libgtkd.a installed!
Back to top
View user's profile Send private message
kaarna



Joined: 03 Apr 2006
Posts: 92
Location: Finland

PostPosted: Sat May 02, 2009 11:49 am    Post subject: Reply with quote

I don't know anything about Code::Blocks, but I guess you need to link in libdl. On the command line this is done usually with -ldl or -L-ldl, but in Code::Blocks you propably need to add the library to your project from somewhere like /usr/lib/libdl.so or libdl.a. I can't check if those are the exact names, as I'm not writing this on linux. But it should be something like that...

libdl will enable gtkD to load the GTK+ and other libraries dynamically while your program is running.
Back to top
View user's profile Send private message AIM Address MSN Messenger
nazarel



Joined: 01 May 2009
Posts: 8
Location: Houston

PostPosted: Sat May 02, 2009 12:34 pm    Post subject: Almost there... Reply with quote

Ok, I linked in the libdl.a from usr/lib - it gave me some more errors about _dlopen, etc. - so I linked in libc.a

It now compiles with the warning:

Code:
Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking


The code runs, but in the terminal it reads:

Code:
Segmentation Fault


Thanks for da info!
Back to top
View user's profile Send private message
kaarna



Joined: 03 Apr 2006
Posts: 92
Location: Finland

PostPosted: Sat May 02, 2009 2:05 pm    Post subject: Reply with quote

Maybe, if you haven't already done so, you could first test your environment by using DSSS to build gtkD and some demos. http://www.dsource.org/projects/gtkd/wiki/BuildingWithDSSS

And if that works, I think that after that point it's pretty much a question of how Code::Blocks works with linking libraries, so you might need to ask someone who knows that particular IDE.
Back to top
View user's profile Send private message AIM Address MSN Messenger
nazarel



Joined: 01 May 2009
Posts: 8
Location: Houston

PostPosted: Sat May 02, 2009 4:27 pm    Post subject: Posted in CodeBlocks forum Reply with quote

I posted my question in the Code::Blocks forum - I'll see if they can help. Thanks kaarna and mike!
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Sun May 03, 2009 7:50 am    Post subject: Re: Almost there... Reply with quote

nazarel wrote:
Ok, I linked in the libdl.a from usr/lib - it gave me some more errors about _dlopen, etc. - so I linked in libc.a

It now compiles with the warning:

Code:
Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking


The code runs, but in the terminal it reads:

Code:
Segmentation Fault


Thanks for da info!


Try libdl.so this is whats normally linked in. Or add -ldl to the linker options instead of pointing it to the library, if Codeblocks allows you to do that.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group