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

compiling on ubuntu

 
Post new topic   Reply to topic     Forum Index -> dallegro
View previous topic :: View next topic  
Author Message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Sat May 16, 2009 6:23 pm    Post subject: compiling on ubuntu Reply with quote

I got DAllegro set up with DMD1.045 on Ubuntu. But I don't know what I have to enter to compile a file.
All of the examples compiled fine(except one, exxfade.d, which was easily fixed by commenting out a line) when I ran the make command.
What do I have to enter in the terminal to compile a file like:

Code:
module allegrotest;
import allegro.allegro;
void main()
{
}


I have built Bud, so I can use that, and I got the necessary library files from building Allegro 4.2.2.
Back to top
View user's profile Send private message
torhu



Joined: 30 Mar 2006
Posts: 56

PostPosted: Sat May 16, 2009 7:52 pm    Post subject: Reply with quote

It's something like this:

bud allegrotest.d -L-lalleg-4.2.2 -L-lalleg_unsharable

If that doesn't work, check the output of 'allegro-config --libs'. That'll print the needed linker arguments, you just need to convert them to dmd syntax.

dmd will pass on any argument prefixed by '-L' literally to the linker, meaning either gcc or ld on linux. Not sure which one, but I think it's gcc instead of ld directly.
Back to top
View user's profile Send private message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Sat May 16, 2009 8:02 pm    Post subject: Reply with quote

Code:
michael@ubuntu:~/dtest$ build allegrotest.d -UMB=Yes -L-lalleg-4.2.2 -L-lalleg_unsharable
/usr/bin/ld: cannot find -lphobos
collect2: ld returned 1 exit status


I added that -UMB=Yes option because the .o files were being placed in dmd/src/import/allegro, and I would get errors saying gcc couldn't find them.

How would I check the output of allegro-config --libs??
Back to top
View user's profile Send private message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Sat May 16, 2009 8:18 pm    Post subject: Reply with quote

Oh, I got it. Very Happy
Will post what I did later, time for bed. Laughing

edit: Okay, I'm awake. Razz
My final, working command was this:
Code:
michael@ubuntu:~/dtest$ build allegrotest.d -UMB=Yes -clean -L-L/home/michael/dmd/linux/lib -L-lalleg-4.2.2 -L-lalleg_unsharable
michael@ubuntu:~/dtest$


Now I have a working DAllegro installation!
But, a question.

Code:
michael@ubuntu:~/dtest$ build allegrotest.d -UMB=Yes -clean -L-lalleg-4.2.2 -L-lalleg_unsharable
/usr/bin/ld: cannot find -lphobos
collect2: ld returned 1 exit status
michael@ubuntu:~/dtest$ build allegrotest.d -UMB=Yes -clean -L-L/home/michael/dmd/linux/lib -L-lalleg-4.2.2 -L-lalleg_unsharable
michael@ubuntu:~/dtest$


Why does the first example not work, but the second one does, even though I have home/michael/dmd/linux/lib in my DFLAGS in dmd.conf?
Here is my dmd.conf:
Code:
[Environment]

DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/import -L-L%@P%/../lib


Thanks for all of your help, I really appreciate it. Very Happy
Back to top
View user's profile Send private message
torhu



Joined: 30 Mar 2006
Posts: 56

PostPosted: Sun May 17, 2009 10:33 am    Post subject: Reply with quote

I'm no sure why that doesn't work. Sure you only have one dmd.conf, you're not using a different one than you think you are?

You could try building without bud, with only dmd, or even try dsss/rebuild. I remember having some trouble with bud on linux, I think most people use dsss or rebuild there.
Back to top
View user's profile Send private message
michaelp



Joined: 27 Jul 2008
Posts: 114

PostPosted: Sun May 17, 2009 11:37 am    Post subject: Reply with quote

Well, I don't have more than 1 dmd.conf, so that's not it.
It's okay though, I got a .sh file to do my building for me, so all I have to type is:
Code:
budall.sh filename.d

and my file will be built. Very Happy
Besides, DSSS got too confusing for me, even though for Bud I had to modify the Bud sources to build Bud because some files had the name 'macro' in it. Razz
Thanks for helping.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> dallegro 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