1

我正在尝试使用 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 的,该 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
4

2 回答 2

1

伊恩,谢谢你张贴。根据config.log我自己的经验,我有一个至少应该解决这个问题的答案(不能保证你在构建的后期不会遇到其他问题)。

这里的关键问题是,如果你告诉它编译器是 gcc(默认情况下),它会尝试使用 openMP。但实际上在 Mavericks 上调用 gcc 会给你 clang++,openMP 对此不起作用。因此,您必须明确告诉 galsim 编译器是 clang++,这样它就不会尝试使用 openMP。(这方面的线索是config.log,在各个地方都有关于x86_64架构未定义符号的消息......当我开始使用 Mavericks 时,我在自己的系统上遇到了这个问题。另见https://github.com/GalSim-developers/ GalSim/issues/493

所以,请这样做scons CXX=clang++,这个问题应该会消失。但是,我不能保证您以后不会遇到提升问题。

于 2014-01-10T14:16:08.593 回答
1

另请参阅此问题,其中有两个建议也可能有助于为您解决问题。

于 2014-06-02T19:07:12.013 回答