PDA

View Full Version : How can I compile this source?




ZebraineZ
Oct 5, 2010, 03:19 AM
http://www.mediafire.com/?zuzrmz2asbm39sm

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.



Hansr
Oct 5, 2010, 03:35 AM
make powder-x or make powder-x-ogl should work according to the makefile.

mac2x
Oct 5, 2010, 01:16 PM
The way I do it (note that you MUST have the Developer Tools installed):

In the Terminal:


[EDIT] I didn't notice the file was a .zip. Just double click on it and let Archive Utility do the work.

cd into the newly unzipped folder, or browse it in Finder.

Look through it and find (and read!) the documentation, if any exists.

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.
./configure
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.
make
Then, install it.
make install
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

ZebraineZ
Oct 6, 2010, 01:06 AM
The way I do it (note that you MUST have the Developer Tools installed):


Place the tarball where you want to work (Downloads folder should be fine)

cd to this directory and unarchive. Use

tar xzvf

for gzipped tarballs (*.tar.gz), and

tar xjvf

for bzipped (*.tar.bz) tarballs.

cd into the directory that came out of the tarball.

Look through it and find (and read!) the documentation, if any exists.

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.
./configure
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.
make
Then, install it.
make install
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


English please.

mac2x
Oct 6, 2010, 01:47 AM
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.

ZebraineZ
Oct 6, 2010, 04:52 AM
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.

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

cd /powder
make powder-x

error: http://pastebin.com/der7e1a7

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

Hansr
Oct 6, 2010, 05:02 AM
Install this first with ZebraineZ's instructions:
http://www.libsdl.org/release/SDL-1.2.14.tar.gz

mac2x
Oct 6, 2010, 08:25 AM
Thank you. Well I finally got it BUT I get an error when I do this:

cd /powder
make powder-x

error: http://pastebin.com/der7e1a7

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

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?

robvas
Oct 6, 2010, 08:51 AM
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)

ZebraineZ
Oct 6, 2010, 05:44 PM
I installed SDL like you said, and here is the error I get:

http://pastebin.com/XMn3Wzfe

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.

robvas
Oct 6, 2010, 07:39 PM
I installed SDL like you said, and here is the error I get:


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:

http://www.libsdl.org/release/SDL-1.2.14.tar.gz

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.

./configure

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

make

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.

ZebraineZ
Oct 7, 2010, 12:54 AM
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:

http://www.libsdl.org/release/SDL-1.2.14.tar.gz

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.

./configure

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

make

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.

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 powdertoy.co.uk

Hansr
Oct 7, 2010, 04:14 AM
make powder-x-gui should bind it into an application bundle.

ZebraineZ
Oct 7, 2010, 05:58 AM
make powder-x-gui should bind it into an application bundle.

Rephrase that O_o it did didn't work lol.

Hansr
Oct 7, 2010, 08:33 AM
Doing make powder-x-gui instead of make powder-x should return an normal MacOS application.

ZebraineZ
Oct 7, 2010, 05:29 PM
Doing make powder-x-gui instead of make powder-x should return an normal MacOS application.

That doesn't work :(

make: *** No rule to make target `powder-x-gui'. Stop.

Hansr
Oct 7, 2010, 05:50 PM
make powder-x-ogl

ZebraineZ
Oct 7, 2010, 06:28 PM
make powder-x-ogl

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: http://i56.tinypic.com/2i9pmy0.png

mac2x
Nov 26, 2010, 02:48 PM
Doing make powder-x-gui instead of make powder-x should return an normal MacOS application.

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.

mac2x
Nov 26, 2010, 03:27 PM
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. :)

ZebraineZ
Nov 29, 2010, 04:46 AM
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. :)

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, "Powder.app" 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.

mac2x
Nov 29, 2010, 08:12 PM
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. :)

ZebraineZ
Nov 30, 2010, 03:10 AM
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. :)

Haha, no problem.

One little thing lol, don't use that source up there...it's an outdated version of a mod/fork of the official one, all of which could be found at the games site http://powdertoy.co.uk/, 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!