View previous topic :: View next topic |
Author |
Message |
michaelp
Joined: 27 Jul 2008 Posts: 114
|
Posted: Sat May 16, 2009 6:23 pm Post subject: compiling on ubuntu |
|
|
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 |
|
|
torhu
Joined: 30 Mar 2006 Posts: 56
|
Posted: Sat May 16, 2009 7:52 pm Post subject: |
|
|
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 |
|
|
michaelp
Joined: 27 Jul 2008 Posts: 114
|
Posted: Sat May 16, 2009 8:02 pm Post subject: |
|
|
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 |
|
|
michaelp
Joined: 27 Jul 2008 Posts: 114
|
Posted: Sat May 16, 2009 8:18 pm Post subject: |
|
|
Oh, I got it.
Will post what I did later, time for bed.
edit: Okay, I'm awake.
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. |
|
Back to top |
|
|
torhu
Joined: 30 Mar 2006 Posts: 56
|
Posted: Sun May 17, 2009 10:33 am Post subject: |
|
|
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 |
|
|
michaelp
Joined: 27 Jul 2008 Posts: 114
|
Posted: Sun May 17, 2009 11:37 am Post subject: |
|
|
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.
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.
Thanks for helping. |
|
Back to top |
|
|
|