SIGSYS crash

Official forum for the Chipmunk2D Physics Library.
Post Reply
rmyers
Posts: 6
Joined: Tue Aug 28, 2012 5:26 pm
Contact:

SIGSYS crash

Post by rmyers »

Hi, I am new to this stuff and I am having a really annoying issue that no one else seems to be having, so I am obviously doing something wrong. I built a game that runs perfectly fine on the simulator, but crashes almost immediately when I run it on a device. I factored out this simple case:

Code: Select all

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    cpInitChipmunk();
    cpSpace* space = cpSpaceNew();
    
    space->sleepTimeThreshold = INFINITY;
    
    cpVect grav = cpv(0, GAME_GRAVITY);
    cpSpaceSetGravity(space, grav);
    cpSpaceSetIterations(space, SPACE_ITERATIONS);
    
    double viewHeight = self.view.bounds.size.height;
    double viewWidth = self.view.bounds.size.width;
    
    cpBody* rbound = cpBodyNewStatic();
    cpBody* lbound = cpBodyNewStatic();
    cpShape* lboundShape = cpSegmentShapeNew(lbound, cpv(0,0), cpv(0,viewHeight),0);
    cpShape* rboundShape = cpSegmentShapeNew(rbound, cpv(viewWidth,0), cpv(viewWidth,viewHeight), 0);
    
    cpShapeSetElasticity(lboundShape, 0.2);
    cpShapeSetElasticity(rboundShape, 0.2);
    cpShapeSetFriction(lboundShape, 0);
    cpShapeSetFriction(rboundShape, 0);
    cpSpaceAddShape(space,rboundShape);
    cpSpaceAddShape(space, lboundShape);
}
And what happens is, the program receives a SIGSYS signal, at the stack trace:

Code: Select all

0 leafSetTrans
1 cpBBTreeInsert
2 cpSpaceAddStaticShape
3 cpSpaceAddShape
4 -[PPTestViewController viewDidLoad]
at the first cpSpaceAddShape call.

I couldn't find anything with Google that was helpful, so hopefully someone here can point me in the right direction. Some kind of compiler setting maybe?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: SIGSYS crash

Post by slembcke »

Hmm. That's a super weird signal to crash on in that function. It's when you call a system function with a bad argument. I couldn't reproduce the error. Can you give me any more information? Which Chipmunk/Xcode/SDK versions? Can you make a project that replicates the issue as simply as possible that you can send me?

So leafSetTrans() may have some other function calls into it which may call calloc(). There is also an assertion to check if the allocation worked correctly that may call cpMessage() which can call printf() and friends. So something with a failed allocation is the best I can think of for what is causing the SIGSYS.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
rmyers
Posts: 6
Joined: Tue Aug 28, 2012 5:26 pm
Contact:

Re: SIGSYS crash

Post by rmyers »

I'm using Xcode 4.0.2, sdk 4.3. I'm not sure how to find out the chipmunk version; I'm not the one who set up the project originally, but I assume he downloaded the latest one when he started on it in June.

I made a new test project that behaves the same way, but the .zip file of it is too big to attach here. I just started with an empty project, copied the Chipmunk-iPhone directory into it, then copied the code below into RootViewController's viewDidLoad. It works fine in the simulator, but when I try to run it on a 4.3.5 iTouch, I get the crash as above.

Thanks a lot for looking into this.
rmyers
Posts: 6
Joined: Tue Aug 28, 2012 5:26 pm
Contact:

Re: SIGSYS crash

Post by rmyers »

Update: I tried it with an older device, a 3rd gen iTouch running 4.2.1, and it did work, so that led me to believe it was finally time to update my XCode version. I tried that on a newer machine and it worked fine with the one that was crashing before.
It still would be nice to know if there's something I can do on the older machine to make it work, but I guess this is a good enough solution for now.
Thanks again.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: SIGSYS crash

Post by slembcke »

Hmm. Well that's good to know then.

I really have no idea what would be causing the issue though unfortunately...
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests