2010-05-19 138 views
0

我試圖在Mac OS X 10.6.3中安裝h5py。在Mac OS X中安裝h5py 10.6.3

首先我安裝HDF5 1.8,它使用下面的命令:

./configure \ 
--prefix=/Library/Frameworks/Python.framework/Versions/Current \ 
--enable-shared \ 
--enable-production \ 
--enable-threadsafe \ 
CPPFLAGS=-I/Library/Frameworks/Python.framework/Versions/Current/include \ 
LDFLAGS=-L/Library/Frameworks/Python.framework/Versions/Current/lib 

make 
make check 
sudo make install 

然後安裝h5py:

/Library/Frameworks/Python.framework/Versions/Current/bin/python \ 
setup.py \ 
build \ 
--api=18 \ 
--hdf5=/Library/Frameworks/Python.framework/Versions/Current 

然後我得到的錯誤:

****************************************** 
Configure: Autodetecting HDF5 settings... 
    Custom HDF5 dir:  /Library/Frameworks/Python.framework/Versions/Current 
    Custom API level:  (1, 8) 
ld: warning: in detect/vers.o, file was built for unsupported file format which is not the architecture being linked (i386) 

ld: warning: in /Library/Frameworks/Python.framework/Versions/Current/lib/libhdf5.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 

Undefined symbols: 
    "_main", referenced from: 
     start in crt1.10.5.o 

ld: symbol(s) not found 

collect2: ld returned 1 exit status 

Failed to compile HDF5 test program. Please check to make sure: 

* You have a C compiler installed 
* A development version of Python is installed (including header files) 
* A development version of HDF5 is installed (including header files) 
* If HDF5 is not in a default location, supply the argument --hdf5=<path> 
****************************************** 
error: command 'cc' failed with exit status 1 

我剛剛更新我的Xcode,我不知道這是否是因爲我的gcc的默認設置。如果是這樣,我該如何擺脫這個錯誤?

謝謝。

回答

1

我只是碰到了類似的錯誤來試圖建立與英特爾C/C++編譯器在Mac OS X Python擴展模塊。要修復「未定義的符號:_main」錯誤,我必須將以下內容添加到鏈接器命令中:-bundle -undefined dynamic_lookup

您可以執行'man ld'來查明特定的鏈接器命令的功能,但基本上您告訴鏈接器不要擔心未定義的符號,並在庫加載時動態查找它們。