【问题标题】:Installing GalSim, on OSX with anaconda在 OSX 上使用 anaconda 安装 GalSim
【发布时间】:2014-01-06 12:35:00
【问题描述】:

我正在尝试使用 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

【问题讨论】:

  • 您能否检查一下config.log的输出并粘贴与失败测试对应的信息?我同意 boost 似乎确实出了点问题,但我不能说这是否是导致您看到的 GalSim 错误的原因,除非我在 config.log 中看到失败的详细信息。谢谢,雷切尔
  • 瑞秋,感谢您回来。 config.log 是here...对不起,我宁愿给你整个事情而不是错误的部分。伊恩

标签: galsim


【解决方案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++,这个问题应该会消失。不过,我不能保证你以后不会遇到提升问题。

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-08
      • 1970-01-01
      • 1970-01-01
      • 2014-09-19
      • 2013-11-19
      • 1970-01-01
      • 2019-12-29
      • 2015-12-07
      相关资源
      最近更新 更多