我一直试图在安装了Anaconda并设置为默认python的OSX10.9Mavericks上安装GalSim,但遇到了以下错误:
Unable to build a python loadable module using the python executable:
/usr/bin/env python,
the library name libpython2.7.a,
and the libdir //anaconda/lib/python2.7/config.
If these are not the correct library names, you can tell scons the
correct names to use with the flags EXTRA_LIB_PATH and/or EXTRA_LIBS.在检查我的config.log文件时,有几个Undefined symbols for architecture x86_64:实例,即使我确保使用的编译器是clang++,正如GalSim常见问题解答中所建议的那样。
下面的例子也很多:
/usr/bin/env python < .sconf_temp/conftest_73 > .sconf_temp/conftest_73.out
Fatal Python error: PyThreadState_Get: no current thread
sh: line 1: 17019 Abort trap: 6 /usr/bin/env python < ".sconf_temp/conftest_73" > ".sconf_temp/conftest_73.out"我不知道该做些什么来补救这种情况。我已经重新安装了Boost几次,在第一次之后每次都使用./b2 -a命令。我已经确保boost引用了/anaconda/bin/python,并通过检查每个安装的项目配置.jam文件来确认这一点。我已经使用了这些命令
./bootstrap.sh
./b2 -a toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install按照GalSim常见问题解答中的建议。除了尝试重新安装所有必需的软件包之外,我真的不确定还能尝试什么。在我走到最后一步之前,有没有人有什么建议?任何帮助都是非常感谢的。
下面是我最后一次运行scons的输出:
scons: Reading SConscript files ...
SCons is version 2.3.1 using python version 2.7.6
Python is from //anaconda/include/python2.7
Using the following (non-default) scons options:
CXX = clang++
These can be edited directly in the file gs_scons.conf.
Type scons -h for a full list of available options.
Using python = /usr/bin/env python
Using default PYPREFIX = //anaconda/lib/python2.7/site-packages
Using compiler: /usr/bin/clang++
compiler version: 5.1
Determined that a good number of jobs = 2
Checking for C++ header file fftw3.h... yes
Checking for correct FFTW linkage... yes
Checking for boost header files... yes
Checking for C++ header file TMV.h... yes
Using TMV_LINK file: /usr/local/share/tmv/tmv-link
-ltmv -lblas
Mac version is 10.9.3
XCode version is 5.1.1
Checking for correct TMV linkage... (this may take a little while)
Checking for correct TMV linkage... yes
Checking if we can build against Python...
Unable to build a python loadable module using the python executable:
/usr/bin/env python,
the library name libpython2.7.a,
and the libdir //anaconda/lib/python2.7/config.
If these are not the correct library names, you can tell scons the
correct names to use with the flags EXTRA_LIB_PATH and/or EXTRA_LIBS.
Please fix the above error(s) and rerun scons.
Note: you may want to look through the file INSTALL.md for advice.
Also, if you are having trouble, please check the INSTALL FAQ at
https://github.com/GalSim-developers/GalSim/wiki/Installation%20FAQ发布于 2014-06-03 03:02:10
我认为问题的症结在于anaconda的python库没有正确设置安装名称。下面是otool为我系统上的库报告的内容:
$ otool -L /anaconda/lib/libpython2.7.dylib
/anaconda/lib/libpython2.7.dylib:
libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)在Mac上(与其他Unix/Linux版本相反),运行时加载程序会查看要加载到dylib或可执行文件中的所有库的安装名称。因为anaconda在这里没有正确设置,所以当GalSim或boost对其进行编译时,库只有文件名,没有目录。因此,加载程序不知道它在哪里,在正常的地方查找,并首先找到系统版本。
user2932864指向的答案基本上改变了运行时搜索顺序,将anaconda位置放在系统python之前,因此加载器会查找anaconda版本。但是,如果您希望在系统上同时使用这两个python选项,那么这个解决方案就不能很好地工作。更好的解决方案(IMO)是修复anaconda库文件。为此,只需输入(假设您的anaconda安装是在/anaconda中):
sudo install_name_tool -id /anaconda/lib/libpython2.7.dylib /anaconda/lib/libpython2.7.dylib 完成此操作后,我可以使用以下命令成功安装boost (1.53)
./bootstrap.sh --prefix=$HOME/anaconda_install/ --with-python=/anaconda/bin/python2.7
./b2 link=shared
./b2 link=shared install但是boost也有同样的问题。他们也没有正确设置libboost_python.dylib的安装名称。如果这是您系统上唯一的boost安装,那么您可能是对的。但是因为我有很多不同的版本,所以我不得不做
install_name_tool -id $HOME/anaconda_install/lib/libboost_python.dylib $HOME/anaconda_install/lib/libboost_python.dylib然后,我可以使用anaconda python以正常的方式安装GalSim:
scons PYTHON=/anaconda/bin/python PREFIX=$HOME/anaconda_install BOOST_DIR=$HOME/anaconda_install
sudo scons install发布于 2014-06-13 00:26:22
是的,我相信这与我们的底层RPATH/@dynlib@逻辑有关,我们正在对其进行改造:https://github.com/conda/conda-build/pull/111。Linux支持目前已经实现,OS X和Windows都在待办事项列表上。
发布于 2014-05-21 09:36:13
我认为你的问题可能与这个问题有关:Boost.Python python linkage error
简而言之,boost似乎有时会声称链接到anaconda python上,但它确实会链接到system python上。
该页面也有一个解决方案。这看起来有点笨拙,所以你可能想看看其他人是否有想法。但是如果不是,你可以试一下吗?
https://stackoverflow.com/questions/23771608
复制相似问题