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
I am having serious trouble compiling Qt with the OCI plugin.
The Qt version is 5.6.1, and the Oracle instant client version is 12.1.0.2.0. I have installed both the basic and SDK versions, as the Qt online manual asks.
I then try to run the following command:
./configure -I /usr/include/oracle/12.1/client64/ -L /usr/lib/oracle/12.1/client64/lib -prefix /online/daq/antonin/qt_build -plugin-sql-oci -qt-xcb -v
Which produces this output:
+ cd qtbase
+ /online/daq/antonin/qt_source/5.6/Src/qtbase/configure -top-level -I /usr/include/oracle/12.1/client64/ -L /usr/lib/oracle/12.1/client64/lib -prefix /online/daq/antonin/qt_build -plugin-sql-oci -qt-xcb -v
Which edition of Qt do you want to use ?
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
o
This is the Qt Open Source Edition.
You are licensed to use this software under the terms of
the Lesser GNU General Public License (LGPL) versions 2.1.
You are also licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) versions 3.
Type '3' to view the GNU Lesser General Public License version 3.
Type 'L' to view the Lesser GNU General Public License version 2.1.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.
Do you accept the terms of either license? yes
Running configuration tests (phase 1)...
Precompiled-headers support enabled.
g++ -c -fvisibility=hidden fvisibility.c
Symbol visibility control enabled.
cc1plus: error: unrecognized command line option "-fuse-ld=gold"
g++ -o libtest.so -shared -Wl,-Bsymbolic-functions -fPIC bsymbolic_functions.c
Symbolic function binding enabled.
DEFAULT_INCDIRS="/usr/include/c++/4.4.7
/usr/include/c++/4.4.7/x86_64-redhat-linux
/usr/include/c++/4.4.7/backward
/usr/local/include
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include
/usr/include
"
DEFAULT_LIBDIRS="/lib64
/usr/lib64
/online/daq/lib
/usr/lib
/lib
/usr/lib/gcc/x86_64-redhat-linux/4.4.7
"
Done running configuration tests.
Creating qmake...
gmake: Nothing to be done for `first'.
Running configuration tests (phase 2)...
Found pkg-config from $PATH: /usr/bin/pkg-config
Determining architecture... ()
g++ -c -pipe -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../mkspecs/linux-g++ -o arch.o arch.cpp
g++ -o arch arch.o -L/usr/lib/oracle/12.1/client64/lib
Found architecture in binary
CFG_ARCH="x86_64"
CFG_CPUFEATURES=" mmx sse sse2"
System architecture: 'x86_64'
Host architecture: 'x86_64'
C++11 auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o c++11.o c++11.cpp
g++ -Wl,-O1 -o c++11 c++11.o -L/usr/lib/oracle/12.1/client64/lib
C++11 enabled.
C++14 auto-detection... ()
g++ -c -pipe -O2 -std=gnu++1y -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o c++14.o c++14.cpp
cc1plus: error: unrecognized command line option "-std=gnu++1y"
gmake: *** [c++14.o] Error 1
C++14 disabled.
default C++ standard edition auto-detection... ()
g++ -pipe -O2 -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o c++default.ii -E c++default.cpp
default C++ standard edition enabled.
64-bit std::atomic auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o atomic64.o atomic64.cpp
atomic64.cpp:34:18: error: atomic: No such file or directory
atomic64.cpp:37: error: expected unqualified-id before '<' token
atomic64.cpp:37: error: expected ')' before '<' token
atomic64.cpp:37: error: expected initializer before '<' token
gmake: *** [atomic64.o] Error 1
64-bit std::atomic disabled.
64-bit std::atomic in -latomic auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o atomic64.o atomic64.cpp
atomic64.cpp:34:18: error: atomic: No such file or directory
atomic64.cpp:37: error: expected unqualified-id before '<' token
atomic64.cpp:37: error: expected ')' before '<' token
atomic64.cpp:37: error: expected initializer before '<' token
gmake: *** [atomic64.o] Error 1
64-bit std::atomic in -latomic disabled.
sse2 auto-detection... ()
g++ -c -pipe -msse2 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse2.o sse2.cpp
g++ -o sse2 sse2.o -L/usr/lib/oracle/12.1/client64/lib
sse2 enabled.
sse3 auto-detection... ()
g++ -c -pipe -msse3 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse3.o sse3.cpp
g++ -o sse3 sse3.o -L/usr/lib/oracle/12.1/client64/lib
sse3 enabled.
ssse3 auto-detection... ()
g++ -c -pipe -mssse3 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o ssse3.o ssse3.cpp
g++ -o ssse3 ssse3.o -L/usr/lib/oracle/12.1/client64/lib
ssse3 enabled.
sse4_1 auto-detection... ()
g++ -c -pipe -msse4.1 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse4_1.o sse4_1.cpp
g++ -o sse4_1 sse4_1.o -L/usr/lib/oracle/12.1/client64/lib
sse4_1 enabled.
sse4_2 auto-detection... ()
g++ -c -pipe -msse4.2 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o sse4_2.o sse4_2.cpp
g++ -o sse4_2 sse4_2.o -L/usr/lib/oracle/12.1/client64/lib
sse4_2 enabled.
avx auto-detection... ()
g++ -c -pipe -mavx -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o avx.o avx.cpp
g++ -o avx avx.o -L/usr/lib/oracle/12.1/client64/lib
avx enabled.
avx2 auto-detection... ()
g++ -c -pipe -mavx2 -g -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o avx2.o avx2.cpp
cc1plus: error: unrecognized command line option "-mavx2"
gmake: *** [avx2.o] Error 1
avx2 disabled.
ipc_sysv auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o ipc.o ipc.cpp
g++ -Wl,-O1 -o ipc_sysv ipc.o -L/usr/lib/oracle/12.1/client64/lib
ipc_sysv enabled.
zlib auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o zlib.o zlib.cpp
g++ -Wl,-O1 -o zlib zlib.o -L/usr/lib/oracle/12.1/client64/lib -lz
zlib enabled.
mtdev auto-detection... ()
Project ERROR: mtdev development package not found
mtdev disabled.
libjpeg auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o libjpeg.o libjpeg.cpp
libjpeg.cpp: In function 'int main(int, char**)':
libjpeg.cpp:43: warning: 'cinfo' is used uninitialized in this function
g++ -Wl,-O1 -o libjpeg libjpeg.o -L/usr/lib/oracle/12.1/client64/lib -ljpeg
libjpeg enabled.
libpng auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o libpng.o libpng.cpp
g++ -Wl,-O1 -o libpng libpng.o -L/usr/lib/oracle/12.1/client64/lib -lpng
libpng enabled.
libdl auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o libdl.o libdl.cpp
g++ -Wl,-O1 -o libdl libdl.o -L/usr/lib/oracle/12.1/client64/lib -ldl
libdl enabled.
DB2 auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o db2.o db2.cpp
db2.cpp:34:20: error: sqlcli.h: No such file or directory
db2.cpp:35:21: error: sqlcli1.h: No such file or directory
gmake: *** [db2.o] Error 1
DB2 disabled.
InterBase auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o ibase.o ibase.cpp
ibase.cpp:34:19: error: ibase.h: No such file or directory
gmake: *** [ibase.o] Error 1
InterBase disabled.
MySQL (thread-safe) auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -isystem /usr/include/mysql -I../../../mkspecs/linux-g++ -o mysql.o ../mysql/mysql.cpp
g++ -Wl,-O1 -o mysql_r mysql.o -L/usr/lib/oracle/12.1/client64/lib -L/usr/lib64/mysql -lz -lcrypt -lnsl -lm -lpthread -lssl -lcrypto -lmysqlclient_r
MySQL (thread-safe) enabled.
OCI auto-detection... ()
g++ -c -pipe -O2 -std=gnu++0x -Wall -W -fPIC -I. -isystem /usr/include/oracle/12.1/client64 -I../../../mkspecs/linux-g++ -o oci.o oci.cpp
g++ -Wl,-O1 -o oci oci.o -L/usr/lib/oracle/12.1/client64/lib -lclntsh
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `lxXmlCvEsc0'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `lxXmlGEntEscImpl'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `slnxmul'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `zt_init'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `slnxadd'
/usr/lib/oracle/12.1/client64/lib/libclntsh.so: undefined reference to `slnxsub'
collect2: ld returned 1 exit status
gmake: *** [oci] Error 1
OCI disabled.
Oracle (OCI) support cannot be enabled due to functionality tests!
Turn on verbose messaging (-v) to /online/daq/antonin/qt_source/5.6/Src/qtbase/configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to /online/daq/antonin/qt_source/5.6/Src/qtbase/configure to continue.
As you can see, there are several undefined references for one of the the OCI .so files. I have tried checking online, but I have found barely any references to these symbols.
Any idea what could be causing this? A missing .so file? Wrong version of the library?
I am trying to build this library under Mac OS X Lion, gcc4.8, XCode 5.0.2:
https://github.com/zeromq/zmqpp
I built gcc4.8 with:
brew install gcc48 --enable-all-languages
When I try to build it, the linker (in /usr/bin) gives these errors:
$ make
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/context.o src/zmqpp/context.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/frame.o src/zmqpp/frame.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/message.o src/zmqpp/message.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/poller.o src/zmqpp/poller.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/socket.o src/zmqpp/socket.cpp
mkdir -p build/max-g++/obj/zmqpp/
g++ -MMD -std=c++0x -pipe -Wall -fPIC -DBUILD_ENV=max -DBUILD_VERSION='"3.2.0"' -DBUILD_VERSION_MAJOR=3 -DBUILD_VERSION_MINOR=2 -DBUILD_VERSION_REVISION=0 -DBUILD_DATESTAMP='"2014-05-13 07:14"' -DBUILD_LIBRARY_NAME='"zmqpp"' -DBUILD_CLIENT_NAME='"zmqpp"' -I./src -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNDEBUG -c -o build/max-g++/obj/zmqpp/zmqpp.o src/zmqpp/zmqpp.cpp
g++ -shared -dynamic -Wl,libzmqpp.so.3 -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ld: file not found: libzmqpp.so.3
collect2: error: ld returned 1 exit status
make: *** [libzmqpp.so] Error 1
So I removed the r in front of dynamic so that it just reads
-dynamic
That seems to be ok. However, then I get
Mac-mini:zmqpp ivan$ make
g++ -shared -dynamic -Wl,-soname -Wl,libzmqpp.so.3 -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ld: unknown option: -soname
collect2: error: ld returned 1 exit status
make: *** [libzmqpp.so] Error 1
I don't know how to get rid of this error. If I just remove -soname from the Makefile, I get
Mac-mini:zmqpp ivan$ make
g++ -shared -dynamic -Wl,libzmqpp.so.3 -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ld: file not found: libzmqpp.so.3
collect2: error: ld returned 1 exit status
make: *** [libzmqpp.so] Error 1
libzmqpp.so.3 doen't even look like correct protocol for Mac dynamic libraries.
If I remove the entire line and replace it I get
Mac-mini:zmqpp ivan$ make
g++ -shared -dynamic -o ./build/max-g++/libzmqpp.so.3 build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o -lzmq
ar crf ./build/max-g++/libzmqpp.a build/max-g++/obj/zmqpp/context.o build/max-g++/obj/zmqpp/frame.o build/max-g++/obj/zmqpp/message.o build/max-g++/obj/zmqpp/poller.o build/max-g++/obj/zmqpp/socket.o build/max-g++/obj/zmqpp/zmqpp.o
ar: illegal option -- f
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [libzmqpp.a] Error 1
One thing, the ar it is using is the one in /usr/bin not in /usr/local/Cellar/gcc48/4.8.2/bin/gcc, gcc-ar-4.8
g++ -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-current_version,1.0,-install_name,/usr/local/lib/libzmqpp.3.dylib -o libzmqpp.1.dylib ./build/max-g++/obj/zmqpp/context.o ./build/max-g++/obj/zmqpp/frame.o ./build/max-g++/obj/zmqpp/message.o ./build/max-g++/obj/zmqpp/poller.o ./build/max-g++/obj/zmqpp/socket.o ./build/max-g++/obj/zmqpp/zmqpp.o -lzmq
According to this question this should work. I would try with and without the -dynamic. I build shared libraries all day long but don't have a mac. I am not sure why it is trying to build a static library with the ar command.
The mac linker doesn't take the arguments the linux ones do. Here is some information on building shared libraries on Mac.
We are a team working on an R package containing C/C++ code. The package can successfully be installed on all the machines but one. These all run the same version of Mac OS X. I have provided the log files for the installation of the package on my computer (success) and a colleague's computer (error). The package depends on the Rcpp package and the GSL library, both of which were successfully installed on both machines.
My Computer
WARNING: ignoring environment value of R_HOME
* installing to library '/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15'
* installing *source* package 'mrenci' ...
** libs
*** arch - x86_64
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c MRMRTree.cc -o MRMRTree.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c Matrix.cc -o Matrix.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c MiMBuilder.cc -o MiMBuilder.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c SymmetricMatrix.cc -o SymmetricMatrix.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c adaptor.cc -o adaptor.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c memory.cc -o memory.o
/opt/local/bin/g++-mp-4.5 -I/opt/local/lib/R/include -I/opt/local/lib/R/include/x86_64 -DNDEBUG -fopenmp -fopenmp -I/opt/local/include -I"/Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/include" -fPIC -pipe -O2 -m64 -c tools.cc -o tools.o
/opt/local/bin/g++-mp-4.5 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/lib -o mrenci.so MRMRTree.o Matrix.o MiMBuilder.o SymmetricMatrix.o adaptor.o memory.o tools.o /Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/Rcpp/lib/x86_64/libRcpp.a -fopenmp -fopenmp -L/opt/local/lib/R/lib/x86_64 -lR
installing to /Users/dejayn/R/x86_64-apple-darwin10.8.0-library/2.15/mrenci/libs/x86_64
** R
** preparing package for lazy loading
** testing if installed package can be loaded
* DONE (mrenci)
Colleague's Computer
WARNING: ignoring environment value of R_HOME
* installing to library '/Library/Frameworks/R.framework/Versions/2.15/Resources/library'
* installing *source* package 'mrenci' ...
** libs
*** arch - x86_64
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c MRMRTree.cc -o MRMRTree.o
MRMRTree.cc: In member function 'double* const MRMRTree::bootstrap(unsigned int)':
MRMRTree.cc:73: warning: iteration variable 'i' is unsigned
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c Matrix.cc -o Matrix.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c MiMBuilder.cc -o MiMBuilder.o
MiMBuilder.cc: In member function 'Matrix* const MiMBuilder::createMiM(unsigned int*, unsigned int, unsigned int*, unsigned int)':
MiMBuilder.cc:102: warning: iteration variable 'i' is unsigned
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c SymmetricMatrix.cc -o SymmetricMatrix.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c adaptor.cc -o adaptor.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c memory.cc -o memory.o
g++ -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -DNDEBUG -fopenmp -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/include" -fPIC -g -O2 -c tools.cc -o tools.o
g++ -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o mrenci.so MRMRTree.o Matrix.o MiMBuilder.o SymmetricMatrix.o adaptor.o memory.o tools.o /Library/Frameworks/R.framework/Versions/2.15/Resources/library/Rcpp/lib/x86_64/libRcpp.a -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64
** R
** preparing package for lazy loading
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so, 6): Symbol not found: _GOMP_critical_name_end
Referenced from: /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci/libs/x86_64/mrenci.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/mrenci'
At first, the installation on my colleague's computer would result in the compilation of the package for both architectures, upon which g++ complained about an unknown -arch argument. This issue, however, appears to have been mitigated by forcing the targeting of a single architecture x86_64. It is also worth noting that as a result of these errors, all computers now have several versions of R and g++. Is this an issue with the linker? Does the same compiler need to be used for both R and its packages? In the case of my computer, I never explicitly asked for g++-mp-4.5 to be used rather than the default g++ (version 4.2), so I figured R automatically detects it.
In case this is of any help, here is what my Makevars contains:
PKG_LIBS=`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(SHLIB_OPENMP_CFLAGS) -fopenmp
PKG_CPPFLAGS=$(SHLIB_OPENMP_CXXFLAGS) -fopenmp
PKG_CFLAGS=$(SHLIB_OPENMP_CFLAGS) -fopenmp
The $(SHLIB_OPENMP_*FLAGS) flags seem to be defined only on my computer; -fopenmp flags were explicitly added for the package to work on all the machines.
Has anyone experienced similar issues? Any help would be appreciated.
I changed my colleague's ~/.R/Makevars to conform to my configs
LDFLAGS=-L/opt/local/lib
CC=/opt/local/bin/gcc-mp-4.5 -std=gnu99
CXX=/opt/local/bin/g++-mp-4.5
CPP=/opt/local/bin/gcc-mp-4.5 -std=gnu99 -E
CXXCPP=/opt/local/bin/g++-mp-4.5 -E
CFLAGS=-pipe -O2 -m64
CXXFLAGS=-pipe -O2 -m64
SHLIB_CXXLD=/opt/local/bin/g++-mp-4.5
SHLIB_CXXLDFLAGS=-dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
SHLIB_LD=/opt/local/bin/gcc-mp-4.5 -std=gnu99
SHLIB_LDFLAGS=-dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
Additionally, the --no-multiarch argument was used when issuing the installation command. And it now works on his computer.
The problem was because the use of openMP was hardwired (no checks) inside the code and clang did not support openMP at the same I asked the question. My colleague's R was installed using the default (Xcode) compiler when we were trying to use gcc via Mac Ports.
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)"