clang: error: unknown argument: '-n' from libtool on macos - xcode

/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
/bin/sh ./libtool --tag=CXX --mode=link /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Users/unhammer/src/macdivvun-service/Dependencies
/Static/x86_64/include -fvisibility=hidden -std=c++1z -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/unhammer/src/macdivvun-service/Dependencies/Static/x86_64/lib -o hfst-ospell main.o lib
hfstospell.la -n -L/usr/local/lib -licui18n -licuuc -licudata
libtool: link: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Users/unhammer/src/macdivvun-service/Dependencies/Static/x86_64/include -fvisi
bility=hidden -std=c++1z -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -o hfst-ospell main.o -n -Wl,-bind_at_load -L/Users/unhammer/src/macdivvun-service/Dependencies/Static/x86_64/lib ./.libs/lib
hfstospell.a -L/usr/local/lib -licui18n -licuuc -licudata
clang: error: unknown argument: '-n'
make[1]: *** [hfst-ospell] Error 1
make: *** [all] Error 2
Where does that -n come from? How can I find out? I'm using xcodebuild, but xcodebuild -showBuildSettings -scheme Dependencies|grep -e -n gives nothing, and I see no -n in any of the flags in Makefile.am or configure.ac in the actual (autotools) project.

I looked at the actual goal being built in the generated Makefile, starting from the line $(AM_V_CXXLD)$(hfst_ospell_LINK) $(hfst_ospell_OBJECTS) $(hfst_ospell_LDADD) $(LIBS)
and manually checked all the variables there recursively. Finally, I saw that LIBS had -n -L/usr/local/lib -licui18n -licuuc -licudata. And LIBS was LIBS = #LIBS# in Makefile.in, so set by configure.ac, which ran icu-config --ldflags to set it.
For some reason, the version (57.1) of icu-config --ldflags that I had gave -n -L/usr/local/lib -licui18n -licuuc -licudata instead of -L/usr/local/lib -licui18n -licuuc -licudata. Upgrading icu solved it.

Related

"ld: library not found for -lc" in mac big sur

I try to writed a redis module by clone the git project https://github.com/RedisLabs/RedisModulesSDK.git
and type the "Make" command in my mac with big sur version, below message display in the console.
But there is a error "ld: library not found for -lc".
How to fix it. I try the same command in a linux os, it works find.
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o util.o util.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o strings.o strings.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o sds.o sds.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o vector.o vector.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o alloc.o alloc.c
gcc -g -fPIC -O3 -std=gnu99 -Wall -Wno-unused-function -I../ -c -o periodic.o periodic.c
ar rcs librmutil.a util.o strings.o sds.o vector.o alloc.o periodic.o
gcc -I../ -Wall -g -fPIC -lc -lm -std=gnu99 -c -o module.o module.c
clang: warning: -lc: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -lm: 'linker' input unused [-Wunused-command-line-argument]
ld -o module.so module.o -bundle -undefined dynamic_lookup -v -L../rmutil -lrmutil -lc
#(#)PROGRAM:ld PROJECT:ld64-609.8
BUILD 15:07:46 Dec 18 2020
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
../rmutil
/usr/lib
/usr/local/lib
Framework search paths:
/Library/Frameworks/
/System/Library/Frameworks/
ld: library not found for -lc
make[1]: *** [module.so] Error 1
make: *** [module.so] Error 2
To prevent this error on 11.x+: ld: library not found for -lc
the path /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib needs to be added with -L
https://github.com/macports/macports-ports/commit/0a780d32e0ae3997ed2f2d611cee604d1476cdb5

How to remove a link option from ld in make file?

I'm installing a ROOT class and I ran into an error.
caffeinated:libroot-hijing-1.7 sudoankit$ make
/bin/sh ../libtool --tag=CXX --mode=link /usr/bin/g++ -std=gnu++11 -g -O2 -L/usr/local/Cellar/root6/6.06.08/lib/root -R /usr/local/Cellar/root6/6.06.08/lib/root -version-info 1:7:0 -o libTHijing.la -rpath /Users/sudoankit/lib THijing.lo THijingMinBias.lo THijingFlow.lo THijingPara.lo TRanMar.lo ran.lo hijing1.383.lo hipyset1.35.lo THijingDict.lo -lCint -lCore -lTree -lPhysics -lGraf3d -lGraf -lHist -lMatrix -lEG -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0 -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0/../../.. -lgfortran -lquadmath -lm
libtool: link: /usr/bin/g++ -std=gnu++11 -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/libTHijing.1.dylib .libs/THijing.o .libs/THijingMinBias.o .libs/THijingFlow.o .libs/THijingPara.o .libs/TRanMar.o .libs/ran.o .libs/hijing1.383.o .libs/hipyset1.35.o .libs/THijingDict.o -L/usr/local/Cellar/root6/6.06.08/lib/root -lCint -lCore -lTree -lPhysics -lGraf3d -lGraf -lHist -lMatrix -lEG -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0 -L/usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.0.0/6.2.0/../../.. -lgfortran -lquadmath -lm -g -O2 -install_name /Users/sudoankit/lib/libTHijing.1.dylib -compatibility_version 2 -current_version 2.7 -Wl,-single_module
ld: library not found for -lCint
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libTHijing.la] Error 1
make: *** [all-recursive] Error 1
The solution I found after some time is to remove the -lCint library from ld. How should I do this? Where is the linking located in the Makefile? Or the configure file?
An example of filter-out:
A = X Y -lCint Z
B = $(filter-out -lCint, $(A))
all:
#echo $(B)

Building Lua 5.0 on 64bit Mac

For compatibility/legacy reasons I need to build the Lua compiler (luac) from version 5.0, on my 64bit Intel Mac. (5.1 or later can't be used.)
Dev tools installed through Xcode 4.6's Preferences window.
After I 'cd' in to the Lua directory, I issue the command 'make'.
cd include; make all
make[1]: Nothing to be done for `all'.
cd src; make all
make[1]: Nothing to be done for `all'.
cd src/lib; make all
make[1]: Nothing to be done for `all'.
cd src/luac; make all
gcc -o ../../bin/luac luac.o print.o lopcodes.o -L../../lib -llua -llualib -lm
Undefined symbols for architecture x86_64:
"_UNUSED", referenced from:
_writer in luac.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [../../bin/luac] Error 1
make: *** [all] Error 2
I do not know how to configure the make process for x86_64. Could someone please step me through it?
Thanks.
It works for me, but the output below is different from yours:
...
cd src/luac; make all
gcc -O2 -Wall -I../../include -I.. -c -o luac.o luac.c
gcc -O2 -Wall -I../../include -I.. -c -o print.o print.c
gcc -o lopcodes.o -c -O2 -Wall -I../../include -I.. -DLUA_OPNAMES ../lopcodes.c
gcc -o ../../bin/luac luac.o print.o lopcodes.o -L../../lib -llua -llualib -lm
cd src/lua; make all
gcc -O2 -Wall -I../../include -c -o lua.o lua.c
Try make clean all at the top level first.

Cloog-ppl make error

I'm trying to install cloog-ppl 0.15-11 in my 64 bit ubuntu 10.10. I get the following error during make. I guess it is wrt linking.
gcc -DHAVE_CONFIG_H -I. -I./include/cloog -I./include -I./include -Wall -fomit-frame-pointer -g -O2 -MT cloog.o -MD -MP -MF .deps/cloog.Tpo -c -o cloog.o `test -f 'source/cloog.c' || echo './'`source/cloog.c
mv -f .deps/cloog.Tpo .deps/cloog.Po
/bin/bash ./libtool --tag=CC --mode=link gcc -Wall -fomit-frame-pointer -g -O2 -o cloog cloog.o libcloog.la -lgmp -lppl_c -lppl -lgmpxx
libtool: link: gcc -Wall -fomit-frame-pointer -g -O2 -o .libs/cloog cloog.o ./.libs/libcloog.so /usr/lib/libgmp.so -lppl_c -lppl /usr/lib/libgmpxx.so
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::_M_unhook()#GLIBCXX_3.4.15'
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)#GLIBCXX_3.4.15'
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)#GLIBCXX_3.4.15'
//usr/local/lib/libppl_c.so: undefined reference to `std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)#GLIBCXX_3.4.15'
collect2: ld returned 1 exit status
make[1]: *** [cloog] Error 1
make[1]: Leaving directory `/home/praveen/cloog-ppl-0.15.11'
make: *** [all-recursive] Error 1
Can some one help me out on this ?
I have the same problem that I worked for a whole day!! I have a hit, as least this bug disappeared.
When it refers to GLIBCXX_3.4.15 it means that you are using a g++ or gcc with the library not providing the functions or classes you need, very likely 4.4 or 4.5. I changed my g++ and gcc to 4.6 and the problem was solved. For some references, you can check out the following:
How standard lib linked by libstdc++.so.6
Notice: I only get libstdc++.so.5 in /usr/lib when I have g++-4.5 installed. I think libstdc++ is the library that g++ and gcc used.
for changing the compiler version in Linux, see the following link:
Upgrade your compiler
Hope it helps!

Installing Pygame and Pymunk on Mac OS X 10.6

I have not been able to install Pymunk and Pygame for the same version of python. I have tried binaries, source installs, fink, and Macports, for system python, python 2.6, and python 2.7, with 32 and 64 bit versions.
In some cases the pymunk unit tests cause a segmentation fault, in some cases I get symptoms similar to Issue 42, and in some I cannot import pymunk because libchipmunk.dylib is an incompatible architecture.
When I can install pymunk, I cannot install or compile pygame with extended image (pygame.image.get_extended() == 0) or font support, which largely defeats the purpose of using pygame and pymunk together. On some versions of python, such as 2.7 64 bit, I get
building 'pygame.imageext' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch ppc -arch x86_64 -g -O2 -DNDEBUG -g -O3 -Ddarwin -I/Library/Frameworks/SDL.framework/Versions/Current/Headers -I/Library/Frameworks/SDL_image.framework/Versions/Current/Headers -I/usr/local/include -I/usr/local/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/imageext.c -o build/temp.macosx-10.5-fat3-2.7/src/imageext.o
/usr/libexec/gcc/powerpc-apple-darwin10/4.0.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
lipo: can't open input file: /var/tmp//ccuP0D3r.out (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1
When importing pygame, I sometimes get:
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
I haven't had any issues on Ubuntu or Windows, so I think the problem is OS X-specific.
I am somewhat new to makefiles and compile flags, and I have been trying to set up these two modules for three days, so if someone could provide me with a detailed installation procedure that actually works for them, including the relevant .bash_profile and environment variables, I would be extremely grateful.
Edit: I reinstalled python, pygame, and chipmunk+pymunk, and this is the error I am getting with Python 2.7 (32 bit):
$ python2.7-32 flipper.py
Loading chipmunk for Darwin (32bit) [/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib]
2011-10-03 19:03:08.862 Python[3683:60f] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
Initializing cpSpace - Chipmunk v6.0.1 (Debug Enabled)
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
Traceback (most recent call last):
File "flipper.py", line 35, in <module>
space.add_static(static_lines)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 288, in add_static
self.add_static(oo)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 285, in add_static
self._add_static_shape(o)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 327, in _add_static_shape
assert static_shape._hashid_private not in self._static_shapes, "shape already added to space"
AssertionError: shape already added to space
Edit 2: Despite changing the setup.py file to only link for 32-bit, I am getting some odd behavior:
$ sudo python setup.py build_chipmunk
running build_chipmunk
compiling chipmunk...
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/chipmunk.c -o chipmunk_src/chipmunk.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpArbiter.c -o chipmunk_src/cpArbiter.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpArray.c -o chipmunk_src/cpArray.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpBB.c -o chipmunk_src/cpBB.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpBBTree.c -o chipmunk_src/cpBBTree.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpBody.c -o chipmunk_src/cpBody.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpCollision.c -o chipmunk_src/cpCollision.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpHashSet.c -o chipmunk_src/cpHashSet.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpPolyShape.c -o chipmunk_src/cpPolyShape.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpShape.c -o chipmunk_src/cpShape.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpace.c -o chipmunk_src/cpSpace.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceComponent.c -o chipmunk_src/cpSpaceComponent.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceHash.c -o chipmunk_src/cpSpaceHash.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceQuery.c -o chipmunk_src/cpSpaceQuery.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceStep.c -o chipmunk_src/cpSpaceStep.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpatialIndex.c -o chipmunk_src/cpSpatialIndex.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSweep1D.c -o chipmunk_src/cpSweep1D.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpVect.c -o chipmunk_src/cpVect.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpConstraint.c -o chipmunk_src/constraints/cpConstraint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpDampedRotarySpring.c -o chipmunk_src/constraints/cpDampedRotarySpring.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpDampedSpring.c -o chipmunk_src/constraints/cpDampedSpring.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpGearJoint.c -o chipmunk_src/constraints/cpGearJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpGrooveJoint.c -o chipmunk_src/constraints/cpGrooveJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpPinJoint.c -o chipmunk_src/constraints/cpPinJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpPivotJoint.c -o chipmunk_src/constraints/cpPivotJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpRatchetJoint.c -o chipmunk_src/constraints/cpRatchetJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpRotaryLimitJoint.c -o chipmunk_src/constraints/cpRotaryLimitJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpSimpleMotor.c -o chipmunk_src/constraints/cpSimpleMotor.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -arch x86_64 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpSlideJoint.c -o chipmunk_src/constraints/cpSlideJoint.o
cc -dynamiclib -arch i386 chipmunk_src/chipmunk.o chipmunk_src/cpArbiter.o chipmunk_src/cpArray.o chipmunk_src/cpBB.o chipmunk_src/cpBBTree.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/cpSpaceComponent.o chipmunk_src/cpSpaceHash.o chipmunk_src/cpSpaceQuery.o chipmunk_src/cpSpaceStep.o chipmunk_src/cpSpatialIndex.o chipmunk_src/cpSweep1D.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
$ python2.7-32
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymunk
Loading chipmunk for Darwin (32bit) [/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib]
>>> s = pymunk.Space()
Initializing cpSpace - Chipmunk v6.0.1 (Debug Enabled)
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
>>> c1 = pymunk.Circle(s.static_body, 1)
>>> s.add(c1)
>>> c2 = pymunk.Circle(s.static_body, 2)
>>> s.add(c2) #No error!
$ sudo python setup.py install
$ python2.7-32 unittests.py
Loading chipmunk for Darwin (32bit) [/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib]
testing pymunk version 2.0.0
Initializing cpSpace - Chipmunk v6.0.1 (Debug Enabled)
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
FFFFSegmentation fault
$ python2.7-32 flipper.py
Loading chipmunk for Darwin (32bit) [/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib]
2011-10-04 13:49:45.653 Python[6430:60f] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
Initializing cpSpace - Chipmunk v6.0.1 (Debug Enabled)
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
Traceback (most recent call last):
File "flipper.py", line 35, in <module>
space.add_static(static_lines)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 288, in add_static
self.add_static(oo)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 285, in add_static
self._add_static_shape(o)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 327, in _add_static_shape
assert static_shape._hashid_private not in self._static_shapes, "shape already added to space"
AssertionError: shape already added to space
Edit 3: Chipmunk now built and linked for x86, but I am getting the same errors:
$sudo python2.7-32 setup.py build_chipmunk
running build_chipmunk
compiling chipmunk...
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/chipmunk.c -o chipmunk_src/chipmunk.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpArbiter.c -o chipmunk_src/cpArbiter.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpArray.c -o chipmunk_src/cpArray.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpBB.c -o chipmunk_src/cpBB.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpBBTree.c -o chipmunk_src/cpBBTree.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpBody.c -o chipmunk_src/cpBody.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpCollision.c -o chipmunk_src/cpCollision.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpHashSet.c -o chipmunk_src/cpHashSet.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpPolyShape.c -o chipmunk_src/cpPolyShape.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpShape.c -o chipmunk_src/cpShape.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpace.c -o chipmunk_src/cpSpace.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceComponent.c -o chipmunk_src/cpSpaceComponent.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceHash.c -o chipmunk_src/cpSpaceHash.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceQuery.c -o chipmunk_src/cpSpaceQuery.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpaceStep.c -o chipmunk_src/cpSpaceStep.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSpatialIndex.c -o chipmunk_src/cpSpatialIndex.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpSweep1D.c -o chipmunk_src/cpSweep1D.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/cpVect.c -o chipmunk_src/cpVect.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpConstraint.c -o chipmunk_src/constraints/cpConstraint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpDampedRotarySpring.c -o chipmunk_src/constraints/cpDampedRotarySpring.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpDampedSpring.c -o chipmunk_src/constraints/cpDampedSpring.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpGearJoint.c -o chipmunk_src/constraints/cpGearJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpGrooveJoint.c -o chipmunk_src/constraints/cpGrooveJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpPinJoint.c -o chipmunk_src/constraints/cpPinJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpPivotJoint.c -o chipmunk_src/constraints/cpPivotJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpRatchetJoint.c -o chipmunk_src/constraints/cpRatchetJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpRotaryLimitJoint.c -o chipmunk_src/constraints/cpRotaryLimitJoint.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpSimpleMotor.c -o chipmunk_src/constraints/cpSimpleMotor.o
cc -O3 -std=gnu99 -ffast-math -fPIC -DCHIPMUNK_FFI -arch i386 -Ichipmunk_src/include/chipmunk -c chipmunk_src/constraints/cpSlideJoint.c -o chipmunk_src/constraints/cpSlideJoint.o
cc -dynamiclib -arch i386 chipmunk_src/chipmunk.o chipmunk_src/cpArbiter.o chipmunk_src/cpArray.o chipmunk_src/cpBB.o chipmunk_src/cpBBTree.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/cpSpaceComponent.o chipmunk_src/cpSpaceHash.o chipmunk_src/cpSpaceQuery.o chipmunk_src/cpSpaceStep.o chipmunk_src/cpSpatialIndex.o chipmunk_src/cpSweep1D.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
$ sudo python2.7-32 setup.py install
running install
running build
running build_py
copying pymunk/libchipmunk.dylib -> build/lib/pymunk
running install_lib
copying build/lib/pymunk/libchipmunk.dylib -> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk
running install_egg_info
Removing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk-2.0.0-py2.7.egg-info
Writing /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk-2.0.0-py2.7.egg-info
$ python2.7-32 flipper.py
Loading chipmunk for Darwin (32bit) [/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib]
2011-10-05 01:15:15.972 Python[3183:60f] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
Initializing cpSpace - Chipmunk v6.0.1 (Debug Enabled)
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
Traceback (most recent call last):
File "flipper.py", line 35, in <module>
space.add_static(static_lines)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 288, in add_static
self.add_static(oo)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 285, in add_static
self._add_static_shape(o)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/__init__.py", line 327, in _add_static_shape
assert static_shape._hashid_private not in self._static_shapes, "shape already added to space"
$ python2.7-32 unittests.py
Loading chipmunk for Darwin (32bit) [/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib]
testing pymunk version 2.0.0
Initializing cpSpace - Chipmunk v6.0.1 (Debug Enabled)
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
FFFFSegmentation fault
Edit 4: Verification of versions and executable types:
$ file /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib: Mach-O dynamically linked shared library i386
$ file "$( "$(which python2.7-32)" -c "import sys;print(sys.executable)" )"
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: Mach-O universal binary with 2 architectures
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (for architecture i386): Mach-O executable i386
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (for architecture x86_64): Mach-O 64-bit executable x86_64
$ python2.7-32 -c "import sys;print('%x'%sys.maxint)"
7fffffff
Thanks in advance,
Julian Ceipek
(I am the developer of pymunk)
I would suggest you start by getting pygame working. When you have pygame working on a specific python version, then move over and try to get pymunk working on that same version.
When you try with pymunk, the best way to get it working is
Get version directly from svn (tags/pymunk-2.0.0 contains the release version). Unfortunately the zip source distribution of 2.0.0 does not contain the chipmunk sources you need for compiling.
When you have pymunk including the sources, try compiling chipmunk with build_chipmunk (make sure you do this step with the same python version as you want to run it with)
python setup.py build_chipmunk
Hopefully you should now be able to run pymunk.
If this doesnt work its a bit more tricky.
If you're up for some experimenting you can try to modify the setup script to only build chipmunk in 32bit mode (by default it embeds both 32 and 64 bit versions into the dylib file on OSX). That way you will be sure it loads the 32 bit version.
In the setup.py file, http://code.google.com/p/pymunk/source/browse/tags/pymunk-2.0.0/setup.py
edit line 53 from:
compiler_preargs += ['-arch', 'i386', '-arch', 'x86_64']
into
compiler_preargs += ['-arch', 'i386']
and you will also need to edit line 66 from:
compiler.set_executable('linker_so', ['cc', '-dynamiclib', '-arch', 'i386', '-arch', 'x86_64'])
into
compiler.set_executable('linker_so', ['cc', '-dynamiclib', '-arch', 'i386'])
Then run
>python2.7-32 setup.py build_chipmunk
To test if it works you dont need to install the whole thing, you can try directly from the same folder:
>python
>>> import pymunk
>>> s = pymunk.Space()
>>> c1 = pymunk.Circle(s.static_body, 1)
>>> s.add(c1)
>>> c2 - pymunk.Cricle(s.static_body, 2)
>>> s.add(c2) #this line will fail if it still doesnt work
If you still have problem, then the output of this would be helpful (basically Im almost out of ideas here..)
First, run the file tool on the dylib file:
> file /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pymunk/libchipmunk.dylib
Then you can also verify what python is using:
> file "$( "$(which python2.7-32)" -c "import sys;print(sys.executable)" )"
And finally verify that the python version is indeed 32bit
> python2.7-32 -c "import sys;print('%x'%sys.maxint)"

Resources