0
I build numpy from source on my mac to link it to my ATLAS library. Thus, I wanted to run it as described here with these options:
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/"
But the compiler didn't like all of these arch flags and exited with:
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
I could make the installation work when removing the -arch i386 flag:
cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -arch x86_64 -pipe
But this results in an error, when importing 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
My arch
is in fact i386
and my machine
a x86_64h
.
Does this mean, that I installed a wrong ATLAS or am I missing something in the numpy build? Why do I have to pass multiple -arch
flags?
Have you looked at http://www.scipy.org/scipylib/building/macosx.html ?
– ssnobody – 2015-07-20T01:07:26.723The compiler flags aren't needed, because I changed my default compiler to a matching one. Still, I just tried with
export CC=gcc-4.7 export CXX=g++-4.7 export FFLAGS=-ff2c
, which didn't have any effect – Milla Well – 2015-07-20T07:42:04.520Are you trying to build 32-bit code or 64-bit code? Are the libraries you're linking to 32-bit or 64-bit? Only one of -m32 or -m64 will be used, and I believe the last one on the command line will be the one used. – ssnobody – 2015-07-20T15:10:30.630