Reputation: 11
I'm using a physics library called Chipmunk(version 7.0.1) for a game engine in Pharo Smalltalk(version 6). I initialize a Space with a call to function "cpSpaceNew()" and i´m correctly getting the pointer to cpSpace structure. Then i want to set the gravity to the space using a call to function "cpSpaceSetGravity(space, gravity)" and i get a Segmentation Fault. I found a similar question : Segmentation fault on library call but it is old question and did not find solution there.
EDIT:
Getting cpSpace pointer with:
^ self ffiCall: #( cpSpace* cpSpaceNew(void) )
"ffical:" is native call from Smalltalk.
Trying to set the gravity with:
^ (self ffiCalloutIn: thisContext sender)
convention: self ffiCallingConvention;
options: #( optIndirectCall );
function: #(void cpSpaceSetGravity (self , cpVect aVector)) module: self ffiLibraryName
This way of function call is because it is an "inline function" and it is not load in Library.
Upvotes: 0
Views: 203
Reputation: 17347
Which gcc version are you using? I recommend using older or maybe ancient one.
Excerpt from Pharo mailing list:
My understanding is that gcc 4.8(.4) is the default version in trusty, so if anyone else wants to build the VM with the same compiler, they'll need gcc 4.8.
At the moment it is needed because a few people have found that the VM doesn't work properly if compiled with gcc 5.4
Upvotes: 1