Installing GalSim, on OSX with anaconda

358 views Asked by At

I'm trying to install GalSim on OSX Mavericks, using the anaconda python distribution, but keep running into the error:

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.

the /usr/bin/env python is the anaconda one and there is indeed a libpython2.7.a in that libdir.

scons is installed via the conda package management system. boost is installed manually as recommended via

./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

checking the version of python boost links to gives

$ 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)

Is this correct (it doesn't seem so to me -- boost seems to be linking to the libpython2.7 in /usr/local/) and is this what is causing the problem installing GalSim?

Thanks

Ian

Full output:

$ 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
2

There are 2 answers

0
rmandelb On

Ian, thanks for posting that. Based on the config.log and my own experience, I have an answer that should solve at least this problem (no guarantees that you won't hit something else later in the build).

The key problem here is that if you tell it the compiler is gcc (as is the default), it will try to use openMP. But actually invoking gcc on Mavericks gives you clang++, for which openMP doesn't work. So, you have to explicitly tell galsim that the compiler is clang++ so it won't try to use openMP. (The clue to this is in config.log, there are messages in various places about undefined symbols for x86_64 architecture... I had this problem on my own system when I started using Mavericks. See also https://github.com/GalSim-developers/GalSim/issues/493 )

So, please do scons CXX=clang++ and this problem should go away. I cannot guarantee that you won't hit a boost problem later on, however.

0
Mike Jarvis On

Please also see this question which has two suggestions which may help solve the problem for you as well.