Installation trouble with xcode
-
- Posts: 17
- Joined: Sat Jul 31, 2010 8:27 am
- Contact:
Installation trouble with xcode
Hi,
I'm new to Chipmunk and would like to incorporate it into my app. I'm not using cocos2d and don't want to at this time. I'm trying to follow a dated tutorial (http://www.alexandre-gomes.com/articles/chipmunk/) but I'm getting stuck on the setup.
I've done the svn checkout http://chipmunk-physics.googlecode.com/svn/trunk/ chipmunk-physics-read-only to get the latest code. So, now I have some src and include directories that I'd like to get into xcode and start coding.
The problem I have seems to be how I'm importing the src and include folders. I've tried several ways to do it but I keep getting compile errors like my directory structure is incorrect. I've looked at the README but I must be missing something.
How do I get the raw source code into my xcode project?
Thanks for any help.
-Paul
I'm new to Chipmunk and would like to incorporate it into my app. I'm not using cocos2d and don't want to at this time. I'm trying to follow a dated tutorial (http://www.alexandre-gomes.com/articles/chipmunk/) but I'm getting stuck on the setup.
I've done the svn checkout http://chipmunk-physics.googlecode.com/svn/trunk/ chipmunk-physics-read-only to get the latest code. So, now I have some src and include directories that I'd like to get into xcode and start coding.
The problem I have seems to be how I'm importing the src and include folders. I've tried several ways to do it but I keep getting compile errors like my directory structure is incorrect. I've looked at the README but I must be missing something.
How do I get the raw source code into my xcode project?
Thanks for any help.
-Paul
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Installation trouble with xcode
The easy way is to run the iphone-static.sh shell script in the macosx/ directory. Then all you need to do is copy that library and the include/chipmunk/ directory into your project. The script will compile a fat library that runs in debug mode on the simulator and optimized mode on the device. It also ensures that Chipmunk was compiled with all the correct optimization flags. You may need to adjust the SDK version in the script.
There isn't really any trick to include the actual source if that's what you want, but you do need do need to set a few compiler options. For one, Chipmunk is C99 code and GCC defaults to the C89 standard. You need to add the -std=C99, -ffast-math, and -O3 flags as well as disable thumb compilation. Because of this you probably want to compile Chipmunk as a separate static library. Without the correct optimization flags, Chipmunk will run at a fraction of the speed.
There isn't really any trick to include the actual source if that's what you want, but you do need do need to set a few compiler options. For one, Chipmunk is C99 code and GCC defaults to the C89 standard. You need to add the -std=C99, -ffast-math, and -O3 flags as well as disable thumb compilation. Because of this you probably want to compile Chipmunk as a separate static library. Without the correct optimization flags, Chipmunk will run at a fraction of the speed.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Installation trouble with xcode
Oh, and I suppose I should warn you. I merged in some experimental performance features a couple days ago. I thought I had most of the issues worked out before merged the code into trunk, but it seems I may have broken some special cases of adding and removing bodies/shapes/joints to a space. I'm working to get it straightened out ASAP, but you can run "svn up -r480" to update to the version right before I put the changes in if you run into trouble.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 17
- Joined: Sat Jul 31, 2010 8:27 am
- Contact:
Re: Installation trouble with xcode
Thanks for the response. I ran the build script. When you say "include/chipmunk/ directory", do you mean when I "Add existing files" in xcode, that I should navigate to /include/chipmunk and select the chipmunk directory?
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Installation trouble with xcode
I just copy the chipmunk/ directory and drop the static library in there. It really doesn't matter though, Xcode usually figures out the include paths for you and makes a mess of them no matter what.
I updated the iphonestatic.sh script to just build a complete directory that is ready to be copied into your project. I think I also fixed the bugs I was referring to in my previous post. So I would recommend updating and building again.
I updated the iphonestatic.sh script to just build a complete directory that is ready to be copied into your project. I think I also fixed the bugs I was referring to in my previous post. So I would recommend updating and building again.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 17
- Joined: Sat Jul 31, 2010 8:27 am
- Contact:
Re: Installation trouble with xcode
Thanks. I'll try building again. Looking forward to coding with Chipmunk
-
- Posts: 17
- Joined: Sat Jul 31, 2010 8:27 am
- Contact:
Re: Installation trouble with xcode
Hi there,
I think you still may have a bug or something in the trunk. I had some app crashes that I couldn't figure out. I ended up getting the latest version (http://files.slembcke.net/chipmunk/rele ... Latest.tgz) and then compiled it with the macosx iphonestatic.sh that is in the trunk. Once I did that, the code worked.
Tried debugging it and it seemed that every time I added a cpSpaceAddShape(space, ballShape);, the space->activeShapes was empty. The line in my code that crashed was: cpSpaceHashEach(space->activeShapes, &updateShape, nil);
The crash report showed:
I think you still may have a bug or something in the trunk. I had some app crashes that I couldn't figure out. I ended up getting the latest version (http://files.slembcke.net/chipmunk/rele ... Latest.tgz) and then compiled it with the macosx iphonestatic.sh that is in the trunk. Once I did that, the code worked.
Tried debugging it and it seemed that every time I added a cpSpaceAddShape(space, ballShape);, the space->activeShapes was empty. The line in my code that crashed was: cpSpaceHashEach(space->activeShapes, &updateShape, nil);
The crash report showed:
Code: Select all
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000004
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
iPhone Simulator 4.0 (211.1), iPhone OS 4.0.1 (iPhone/8A306)
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 InTheCupScoring 0x00006c88 cpHashSetEach + 84 (cpHashSet.c:220)
1 InTheCupScoring 0x00008256 cpSpaceHashEach + 56 (cpSpaceHash.c:331)
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Installation trouble with xcode
You mean space->activeShapes was NULL or it had no shapes in it?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 17
- Joined: Sat Jul 31, 2010 8:27 am
- Contact:
Re: Installation trouble with xcode
Sorry...wasn't Null, but had no shapes in it. What was strange is that there was a shape in the space->staticShapes.
Who is online
Users browsing this forum: No registered users and 9 guests