Giter Site home page Giter Site logo

Comments (9)

viblo avatar viblo commented on May 21, 2024

From vb%[email protected] on August 30, 2010 13:09:50

Short summary in for those who don't read swedish:
For some reason pymunk doesnt work on 64bit Python on OSX. The code can detect its 64 bit alright (with a check on how big a void pointer is), and it compiles chipmunk in -O3 -std=gnu99 -ffast-math -fPIC -DNDEBUG -arch x86_64 and everything looks fine when it loads it in. However, when doing something more advanced it fails with an error that look similar to what Ive got before when the struct alignment was wrong.

I would very much appreciate if someone could send me a patch or even just an idea on what exactly is the problem. I don't have a OSX machine to test on so it is very hard for me to debug it and I doubt I will be able to fix it for the next release unless I get some input :(

Status: Accepted
Owner: [email protected]

from pymunk.

viblo avatar viblo commented on May 21, 2024

From [email protected] on August 30, 2010 16:46:42

I just checked out the source to start testing, ran "python setup.py build_chipmunk", and the tests all worked...

Previously, I was using the chipmunk build from Homebrew ( http://github.com/mxcl/homebrew ). This builds chipmunk from trunk but I haven't been able to figure out how to make the default chipmunk build show the actual gcc command line. The most it does show is this:

CFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CXXFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CPPFLAGS: -isystem /Users/aat/Homebrew/include
LDFLAGS: -L/Users/aat/Homebrew/lib

Whereas the pymunk build_chipmunk command uses:

cc -O3 -std=gnu99 -ffast-math -fPIC -DNDEBUG -arch i386 -arch x86_64 -Ichipmunk_src/include -c chipmunk_src/chipmunk.c -o chipmunk_src/chipmunk.o
...
cc -dynamiclib -arch i386 -arch x86_64 chipmunk_src/chipmunk.o chipmunk_src/cpArbiter.o chipmunk_src/cpArray.o chipmunk_src/cpBB.o chipmunk_src/cpBody.o chipmunk_src/cpCollision.o chipmunk_src/cpHashSet.o chipmunk_src/cpPolyShape.o chipmunk_src/cpShape.o chipmunk_src/cpSpace.o chipmunk_src/cpSpaceHash.o chipmunk_src/cpVect.o chipmunk_src/constraints/cpConstraint.o chipmunk_src/constraints/cpDampedRotarySpring.o chipmunk_src/constraints/cpDampedSpring.o chipmunk_src/constraints/cpGearJoint.o chipmunk_src/constraints/cpGrooveJoint.o chipmunk_src/constraints/cpPinJoint.o chipmunk_src/constraints/cpPivotJoint.o chipmunk_src/constraints/cpRatchetJoint.o chipmunk_src/constraints/cpRotaryLimitJoint.o chipmunk_src/constraints/cpSimpleMotor.o chipmunk_src/constraints/cpSlideJoint.o -o pymunk/libchipmunk.dylib

So it could be as simple as a mismatch in -arch, or it could be the different versions of chipmunk, or ...

So...in summary, I guess the "solution" for this is to always use build_chipmunk.

from pymunk.

viblo avatar viblo commented on May 21, 2024

From vb%[email protected] on August 31, 2010 03:46:24

Oh, so you say that it works just fine when you run it on a 64bit python on osx? That would be great! If that's the case maybe I can close this issue?

However, in the thread at sweclockers I did one version when pymunk only compiled it in 64bit on 64bit python, and 'You' reported that it didn't work using build_chipmunk.. It was some time ago but I don't remember any special fixes made to the compile or library load code after that.

from pymunk.

viblo avatar viblo commented on May 21, 2024

From [email protected] on September 28, 2010 12:01:47

Hmmm, I might have the same issue here. OS X Snow Leopard, 64-bit, but as I want to use chipmunk within Nodebox (which is a 32-bit application), I had to compile chipmunk as a 32-bit shared library:

$ file /usr/local/lib/libchipmunk.dylib
/usr/local/lib/libchipmunk.dylib: Mac-O dynamically linked shared library i386

However, when I run the unit tests for pymunk, I get quite a few exceptions similar to this:

ERROR: testSegmentQueries (tests.unittests.UnitTestSpace)

Traceback (most recent call last):
File "/Users/ntamas/Development/ThirdParty/pymunk-1.0.0/tests/unittests.py", line 110, in setUp
self.s.add(self.s1,self.s2)
File "/Users/ntamas/Development/ThirdParty/pymunk-1.0.0/pymunk/init.py", line 160, in add
self._add_shape(o)
File "/Users/ntamas/Development/ThirdParty/pymunk-1.0.0/pymunk/init.py", line 205, in _add_shape
assert shape._hashid not in self._shapes, "shape already added to space"
AssertionError: shape already added to space

The last exception is this:

FAIL: testShape (tests.unittests.UnitTestShape)

Traceback (most recent call last):
File "/Users/ntamas/Development/ThirdParty/pymunk-1.0.0/tests/unittests.py", line 86, in testShape
self.assertFalse( c.point_query((0,0)) )
AssertionError

I've just downloaded pymunk-1.0.0 again and recompiled everything, but it seems to be the same. Can you please help me with this?

FYI, when I compiled chipmunk (version 5.3.1), I simply downloaded the source code, then I did the following:

mkdir build
cd build
cmake ..
ccmake .

edited CMAKE_C_FLAGS and CMAKE_CXX_FLAGS to include -m32; they were empty before

make
cp src/libchipmunk*dylib /usr/local/lib

from pymunk.

viblo avatar viblo commented on May 21, 2024

From [email protected] on September 28, 2010 12:23:48

Hang on, it seems to work if I use the exact same version of chipmunk that is packaged with pymunk. Sorry for the false alarm.

from pymunk.

viblo avatar viblo commented on May 21, 2024

From vb%[email protected] on September 29, 2010 04:43:49

Great that you got it to work! When you say that you use the exact same version of chipmunk that is included in pymunk do you mean that you built it with setup.py build_chipmunk, or that you downloaded the same svn-version from the chipmunk repo?

from pymunk.

viblo avatar viblo commented on May 21, 2024

From [email protected] on September 29, 2010 04:45:40

I built it with setup.py build_chipmunk; I can try it using the SVN version this evening.

from pymunk.

viblo avatar viblo commented on May 21, 2024

From [email protected] on September 29, 2010 14:10:29

Just checked, it works with the SVN version as well. So the bottom line for others seeing the same test failures is that one has to use the exact same version of chipmunk, not the most recent one.

from pymunk.

viblo avatar viblo commented on May 21, 2024

From [email protected] on August 28, 2011 09:40:26

Change this to done as there hasn't been any comments in almost a year and last report said it was working.

Status: Fixed

from pymunk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.