내 Mac의 소스에서 numpy를 빌드하여 ATLAS 라이브러리에 연결합니다. 따라서 설명대로 실행하고 싶었습니다.여기 다음 옵션을 사용하세요.
export MACOSX_DEPLOYMENT_TARGET=10.10
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
export PYTHONPATH="/Library/Python/2.6/site-packages/"
그러나 컴파일러는 이러한 모든 아치 플래그를 좋아하지 않았고 다음과 같이 종료되었습니다.
C compiler: cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -arch x86_64 -arch i386 -pipe
compile options: '-c'
cc: _configtest.c
cc _configtest.o -L/usr/local/atlas/lib -llapack -lf77blas -lcblas -latlas -o _configtest
ld: warning: ignoring file _configtest.o, file was built for i386 which is not the architecture being linked (x86_64): _configtest.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
-arch i386 플래그를 제거하면 설치 작업을 수행할 수 있습니다.
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -arch x86_64 -pipe
그러나 numpy를 가져올 때 오류가 발생합니다.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/numpy/__init__.py", line 170, in <module>
from . import add_newdocs
File "/Library/Python/2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/Library/Python/2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/Library/Python/2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/Library/Python/2.7/site-packages/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: dlopen(/Library/Python/2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find:
/Library/Python/2.7/site-packages/numpy/core/multiarray.so: mach-o, but wrong architecture
내 arch
는 사실 i386
이고 내 machine
a 입니다 x86_64h
.
이것은 내가 잘못된 ATLAS를 설치했다는 뜻입니까, 아니면 numpy 빌드에 뭔가가 빠졌다는 뜻입니까? 왜 여러 플래그를 전달해야 합니까 -arch
?