我正在尝试在我的 Mac 上从这里编译一个 s-transform python 包装器(Mountain Lion,从 Macports 安装的 gcc45,通过 Enthought 64 位安装的 Python)。
我是科学用户而不是编译器专家,虽然它在我的 Linux 机器上开箱即用(只是更改为int
和npy_intp
),但我真的不知道如何在我的 Macbook 上到达那里......PyArray_FromDims
PyArray_SimpleNew
所以我构建了这个 Makefile:
PYINCDIR = /Library/Frameworks/EPD64.framework/Versions/Current/include/python2.7
NUMPYDIR = /Library/Frameworks/EPD64.framework/Versions/Current/lib/python2.7/site-packages/numpy/core/include/numpy CFLAGS = -O3 -I$(PYINCDIR) -I$(NUMPYDIR) -fPIC
all: sinemodule.so stmodule.so
sinemodule.so: sinemodule.o $(CC) -shared -o $@ sinemodule.o
stmodule.so: stmodule.o st.o $(CC) -shared -o $@ stmodule.o st.o
-lfftw3
并试图“制造”,我得到:
cc -shared -o sinemodule.so sinemodule.o
Undefined symbols for architecture x86_64:
"_PyArg_ParseTuple", referenced from:
_sine_taper_wrap in sinemodule.o
"_PyCObject_AsVoidPtr", referenced from:
_initsine in sinemodule.o
"_PyCObject_Type", referenced from:
_initsine in sinemodule.o
"_PyErr_Format", referenced from:
_initsine in sinemodule.o
"_PyErr_Print", referenced from:
_initsine in sinemodule.o
"_PyErr_SetString", referenced from:
_initsine in sinemodule.o
"_PyExc_AttributeError", referenced from:
_initsine in sinemodule.o
"_PyExc_ImportError", referenced from:
_initsine in sinemodule.o
"_PyExc_RuntimeError", referenced from:
_initsine in sinemodule.o
"_PyImport_ImportModule", referenced from:
_initsine in sinemodule.o
"_PyObject_GetAttrString", referenced from:
_initsine in sinemodule.o
"_Py_InitModule4_64", referenced from:
_initsine in sinemodule.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sinemodule.so] Error 1
也许这是一个非常基本的事情,但老实说,我什至不知道从哪里开始阅读以解决它......
为你的帮助干杯!