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

[Solved] Compiling libgtkd.a on linux

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



Joined: 07 Jun 2006
Posts: 18

PostPosted: Fri Apr 18, 2008 7:56 am    Post subject: [Solved] Compiling libgtkd.a on linux Reply with quote

Hello there,


I am having trouble compiling the first example on Linux. I try to compile using "dsss build", but it doesn't output a libgtkd.a file, only these:
libDD-atk.a
libDD-gdkpixbuf.a
libDD-gobject.a
libDD-gtkc.a
libDD-cairo.a
libDD-glade.a
libDD-gthread.a
libDD-pango.a
libDD-gdk.a
libDD-glib.a
libDD-gtk.a

Is this normal?

I am trying to build the first example using Codeblocks. Simply including these .a:s produces a LOT of undefined reference errors. Could you point me in the right direction on this one?

Many thanks!


Last edited by Nox / Lux on Mon Apr 21, 2008 5:23 am; edited 1 time in total
Back to top
View user's profile Send private message
Nox / Lux



Joined: 07 Jun 2006
Posts: 18

PostPosted: Fri Apr 18, 2008 8:27 am    Post subject: Reply with quote

Update:
I thought I'd try to just include the gtkD source files when compiling my project - something that is not a big deal seeing how fast D compilation really is. However, I run into this problem instead:

../gtkD/src/gtkc/paths.d|22|module gtkc.paths module and package have the same name|
||=== Build finished: 1 errors, 0 warnings ===|

Does anyone know what that is supposed to mean?
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Fri Apr 18, 2008 1:24 pm    Post subject: Re: Compiling libgtkd.a on linux Reply with quote

Nox / Lux wrote:
Hello there,


I am having trouble compiling the first example on Linux. I try to compile using "dsss build", but it doesn't output a libgtkd.a file, only these:
libDD-atk.a
libDD-gdkpixbuf.a
libDD-gobject.a
libDD-gtkc.a
libDD-cairo.a
libDD-glade.a
libDD-gthread.a
libDD-pango.a
libDD-gdk.a
libDD-glib.a
libDD-gtk.a

Is this normal?


Yes, this is normal when building with dsss. dsss creates a lib for every Directory, dsss takes care of linking the needed libraries when building the application with dsss.

Quote:
I am trying to build the first example using Codeblocks. Simply including these .a:s produces a LOT of undefined reference errors. Could you point me in the right direction on this one?

Many thanks!


You could try
Code:
--start-group archives --end-group
when linking the application. (see the ld man page for more about this linker option)
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Fri Apr 18, 2008 1:35 pm    Post subject: Reply with quote

Nox / Lux wrote:
Update:
I thought I'd try to just include the gtkD source files when compiling my project - something that is not a big deal seeing how fast D compilation really is. However, I run into this problem instead:

../gtkD/src/gtkc/paths.d|22|module gtkc.paths module and package have the same name|
||=== Build finished: 1 errors, 0 warnings ===|

Does anyone know what that is supposed to mean?


This might have something to do with how the gtkD files are included.

I would suggest building the application with dsss, after doing a dsss build and a dsss install for gtkD. then all you'll need to do build your app is:
Code:
dsss build main.d -L-ldl

where main.d is the file containing your main()
Back to top
View user's profile Send private message
Nox / Lux



Joined: 07 Jun 2006
Posts: 18

PostPosted: Mon Apr 21, 2008 2:36 am    Post subject: Reply with quote

Mike Wey wrote:

I would suggest building the application with dsss, after doing a dsss build and a dsss install for gtkD. then all you'll need to do build your app is:
Code:
dsss build main.d -L-ldl

where main.d is the file containing your main()


Hm, dsss thinks that "main.d is not described in the configuration file" and refuses to compile. I guess I'll have to steal one of the demo .confs and modify it.

In any case, I'd prefer to use an IDE, specifically Codeblocks if at all possible. Going back and forth between the IDE and a console, manually reading references to line numbers instead of the IDE jumping to the right spot automatically etc. adds up in terms hassle involved.

When I include the .a:s, it seems that they run into interdependency errors:
Code:
libDD-gtk.a(gtk.GtkD.o):(.data+0x88): undefined reference to `_D4gtkc8gtktypes12__ModuleInfoZ'

Is there any way I could compile one big lib instead of ten small ones, just to escape this particular headache?
Back to top
View user's profile Send private message
Nox / Lux



Joined: 07 Jun 2006
Posts: 18

PostPosted: Mon Apr 21, 2008 5:17 am    Post subject: Compiling libgtkd.a on linux using CodeBlocks Reply with quote

Right, I found a way to get everything to compile in CodeBlocks.

If anyone is interested, I have uploaded the CodeBlocks project here. Drop it in the root gtkD folder. It should produce libgtkd.a (I haven't tried it in Windows yet).
Edit: Change the build target to "Library" instead of "Debug".

In order to get the Hello World example to compile in CodeBlocks:
1) Right click the project name in CodeBlocks and choose "Build options...".
2) Go to the tab "Search directories" and add "gtkD/src" or wherever the src subfolder of your gtkD folder is located.
3) Go to the "Linker settings" tab and add "libgtkd.a" (the result of compiling the gtkD project), "/usr/lib/libdl.so" and "/usr/lib/libdl.a".

Note: "libgtkd.a" should be at the top and "/usr/lib/libdl.a" should be on the bottom of the list.

That's all - it should now compile.
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