How can I compile this source?

Discussion in 'Mac Programming' started by ZebraineZ, Oct 5, 2010.

  1. macrumors 6502


    It's the source (open source) of a little fun game that I love to play that I would like to compile, but the only way I know to compile is for Windows/Linux, and even though the maker does have OS X ports there isn't a guide (and he doesn't tell us...) for it, like how to and stuff. I'm really dumb and I can't compile this for the love of my life, but I already have dev tools and all that jazz installed, I just need to know the steps to compile this.

    I have snow leopard, and my folder (when you unzip it) is in / and it's named "powder" (the folder, instead of antb or whatever it says) to make it easier you know.

    So either someone can help me compile this myself! Or you guys can just be nice and compile it for me :D or both! Thank you!

    I can't give you logs or errors or whatever (I'm also trying to compile this from terminal just so you know) because I don't know which is which...told you I'm dumb! So yes terminal only please, don't need no GUI.
  2. macrumors 6502a

    make powder-x or make powder-x-ogl should work according to the makefile.
  3. macrumors 65816

    The way I do it (note that you MUST have the Developer Tools installed):

    In the Terminal:

    1. [EDIT] I didn't notice the file was a .zip. Just double click on it and let Archive Utility do the work.
    2. cd into the newly unzipped folder, or browse it in Finder.
    3. Look through it and find (and read!) the documentation, if any exists.
    4. Run the configure script. This will print a lot of lines to the terminal. The documentation should cover anything special that needs to be done in this step, if there is anything.
    5. Assuming the configure script finished successfully, compile. This may take a while, it will print a bazillion lines to terminal, and it will probably use a lot of processor.
    6. Then, install it.
      make install
    7. Note that if what you are compiling is going to a folder under / (e.g. /usr/local/bin is pretty common for command line tools), you'll need to instead use:
      sudo make install
  4. macrumors 6502

    English please.
  5. macrumors 65816

    I made a few edits above. The rest of it is pretty simple.

    Honestly though, if you cannot grasp the rather simple task of compiling software from source, I question your wisdom in using the command line.
  6. macrumors 6502

    Thank you. Well I finally got it BUT I get an error when I do this:

    cd /powder
    make powder-x 

    So as you can see...this is like an alien language to me, and I have no clue what any of those errors mean :( Yes I admit I am pretty dumb with the command line it's the closest way of compiling the source, for OS X at least. It works perfect and easy on Windows and Linux (it's a cross platform game) but when I follow those instructions that the owner has given I still get those errors. If there was an easier way to do it or at least a way from Xcode I'd like to know please :D
  7. macrumors 6502a

  8. macrumors 65816

    IF you can get your hands on an Xcode Project (*.xcodeproj), it would be that easy. ;) For now, looks like you should install SDL as Hansr points out. Refer to the instructions in your quote of me that tell how handle a gzipped tarball (*.tar.gz). Then it's a simple matter of ./configure, make, and (probably) sudo make install. BTW, don't forget the ./configure step! Looks to me like you skipped?
  9. macrumors 68000

    Here's a good reason why it'd be so nice if there was a standard package system for Mac OS (like apt on Debian or Yum on Redhat)
  10. macrumors 6502

    I installed SDL like you said, and here is the error I get:

    Also I do ./configure like you said and it says 'no such file or directory'...what do you mean by that? Doesn't this check for a configure file or something? There is no configure file in the folder so that's a nay lol.

    Also how would I go about doing this from xcode? Can someone just compile that for me so I could at least see if it can be compiled for Mac or not :3 lol.
  11. macrumors 68000

    You didn't install SDL. At least you didn't properly.

    Back to the 'errors' you were getting. When you see stuff like this:
    src/powder.c:813: warning: unused variable ‘tempf1’
    Those are just compiler warnings. They aren't errors, the code still compiled fine, they're just suggestions to the programmer.

    The real errors are at the bottom, where you have symbols not found. That means you're missing code, typically libraries. If you look at the symbol names, they're all SDL-this and SDL-that.

    Download and install SDL. First, get this file:

    Next, open up your console and change to the directory that you downloaded this file to. Probably 'Downloads' in your user folder. Next, type in:

    tar xzf SDL-1.2.14.tar.gz

    This will extract all the files into a folder called SDL-1.2.14. Go to this folder by typing:

    cd SDL-1.2.14

    There's a configure and a makefile in this folder. You'll have to run both.


    It'll check a bunch of stuff. Next, type in:


    It'll compile a bunch of stuff. After it's done, you have one more step:

    sudo make install

    Now, you can go back to the folder you downloaded the powder game to, and type in:

    make powder-x

    It should build. I just did it, neat program.

    Here's a hint, you can usually type in the error message you get, into a search engine like Google, and you'll find someone else who has the same problem and has already solved it.

    Also, if you're having problems with a library such as SDL, visit the website for the project and there's generally information on how to build the library and common issues linking to it.
  12. macrumors 6502

    Holllyyyyy ****! YESSSSSSSSSSSSSSS!
    THANK YOU THANK YOU THANK YOU SOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO MUCH! :D And I'm glad you like it! I'm so happy you have no idea! WOOOT Do you mind if I post this on their forums so others can know too? :D YAYAYYAYAYAYAY!

    Just one question :D what do I do with the powder-x file now? How do I make it an executable with the icon and everything o_O? I have a file called powder-x that is a 'unix executable program' and another one called powder-x.dSYM how do I turn these into an app lol? Like how it is on
  13. macrumors 6502a

    make powder-x-gui should bind it into an application bundle.
  14. macrumors 6502

    Rephrase that o_O it did didn't work lol.
  15. macrumors 6502a

    Doing make powder-x-gui instead of make powder-x should return an normal MacOS application.
  16. macrumors 6502

    That doesn't work :(

    make: *** No rule to make target `powder-x-gui'.  Stop.
  17. macrumors 6502a

    make powder-x-ogl
  18. macrumors 6502

    Hmm, it compiled, except not into an app, it's still a 'unix executable file' and it's really wonky compared to the one when you do 'make powder-x'.

    here is a pic: [​IMG]
  19. macrumors 65816

    I have a feeling this needs to be in the makefile, and it isn't. I don't have much experience with makefiles though, so perhaps someone who does can tell us.
  20. macrumors 65816

    I found a really cheap way to accomplish this. It's not as elegant as getting the right stuff in the makefile, but it works.

    1. Make a new basic Cocoa application project in Xcode. Do not modify.

    2. Build it.

    3. Get the application bundle and move it somewhere.

    4. Replace the executable it gave you with the powder-x executable you compiled already.

    >> Right click, "Show Package Contents", /Contents/MacOS. Get rid of the executable, and replace.

    Voilà. Now you have an application bundle. It's a pretty neat little program. :)
  21. macrumors 6502

    LOL, thanks! I actually did something slightly different. but still this tip was the last piece of the puzzle! I actually tried what you said and it didn't work, but then it hit me! I downloaded the actual application from the games website, "" and I checked inside it and there it was, powder-x! I just replaced it with the one I compiled, like in said in your instructions, and it worked!

    So even though it's not exactly what you said, and probably easier/cleaner but still not as elegant, it works :) thank you so much, I won't bother you no more lol, but I do suggest you play that game, it's incredibly fun.
  22. macrumors 65816

    Yeah, I've had too much fun destroying stuff with Thermite and rocket fuel. :D

    The game seems buggy and crashes a lot though (segfaults are reported if you run the executable from the terminal). Still, a lot of fun. Thanks for introducing me to it. :)
  23. macrumors 6502

    Haha, no problem.

    One little thing lol, don't use that source up's an outdated version of a mod/fork of the official one, all of which could be found at the games site, there are like a ton of different people that mod their own versions, so yeah, if you're interested might as well do it right lol!

Share This Page