我正在尝试使用anaconda python发行版在OSX Mavericks上安装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 /Users/harrison/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.usr/bin/env python是anaconda python,在libdir中确实有一个libpython2.7.a。
scons通过conda包管理系统安装。boost按照以下建议手动安装:
./bootstrap.sh --with-python=/Users/harrison/anaconda/bin/python --with-python-root=/Users/harrison/anaconda/
./b2 -a link=shared
sudo ./b2 -a --prefix=/usr/local link=shared install检查python boost链接的版本,给出
$ otool -L /usr/local/lib/libboost_python.dylib
/usr/local/lib/libboost_python.dylib:
libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)这是正确的(在我看来并非如此-- boost似乎链接到/usr/local/中的libpython2.7 ),这是导致安装GalSim出现问题的原因吗?
谢谢
伊恩
完整输出:
$ scons
scons: Reading SConscript files ...
SCons is version 2.3.0 using python version 2.7.6
Python is from /Users/harrison/anaconda/include/python2.7
Using the following (non-default) scons options:
CXX = g++
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 = /Users/harrison/anaconda/lib/python2.7/site-packages
Using compiler: /usr/bin/g++
compiler version: 4.2.1
Determined that a good number of jobs = 4
Checking for C++ header file fftw3.h... yes
Checking for correct FFTW linkage... yes
Checking for C++ header file boost/shared_ptr.hpp... yes
Checking for C++ header file TMV.h... yes
Using TMV_LINK file: /usr/local/share/tmv/tmv-link
-L/usr/local/Cellar/tmv-cpp/0.71/lib -ltmv -lblas
Mac version is 10.9
WARNING: The Apple BLAS library has been found not to be thread safe on
Mac OS version 10.7 (and possibly higher), even across multiple
processes (i.e. not just multiple threads in the same process).
The symptom is that `scons tests` will hang when running nosetests
using multiple processes.
If this occurs, the solution is to compile TMV either with a
different BLAS library (e.g. ATLAS) or with no BLAS library at
all (using WITH_BLAS=false).
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 /Users/harrison/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-01-10 22:16:09
伊恩,谢谢你把这个贴出来。根据config.log和我自己的经验,我有一个答案,应该至少解决这个问题(不能保证您不会在稍后的构建中遇到其他问题)。
这里的关键问题是,如果您告诉它编译器是gcc (默认情况下),它将尝试使用openMP。但实际上,在小牛上调用gcc会给你带来clang++,而openMP是不起作用的。因此,您必须显式地告诉galsim编译器是clang++的,这样它就不会尝试使用openMP。(这个问题的线索在config.log中,在各个地方都有关于x86_64架构的未定义符号的消息...当我开始使用Mavericks时,我在自己的系统上遇到了这个问题。另请参阅https://github.com/GalSim-developers/GalSim/issues/493 )
所以,请使用scons CXX=clang++,这个问题应该会消失。然而,我不能保证你以后不会遇到boost问题。
发布于 2014-06-03 03:07:12
另请参阅this question,它有两个建议,可能也会帮助你解决这个问题。
https://stackoverflow.com/questions/20950152
复制相似问题