I'm trying to install boost using anaconda on osx. Specifically, I must have it be compioled with gcc
(instead of the osx default clang
). Does anyone know how to do this or if this is even possible with conda? Ideally, I would like two separate boost libraries, one compiled with gcc
and one with clang
.
Assuming that anaconda is installed in
/Users/you/anaconda
the following steps should allow you to compile boost with python using gcc compiler bindings for anaconda:
fix anaconda lib:
install_name_tool -id /Users/you/anaconda/lib/libpython2.7.dylib /Users/you/anaconda/lib/libpython2.7.dylib
(re-)compile boost python
mkdir /Users/you/tmp
cd /Users/you/tmp
wget http://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.bz2/download
mv download boost_1_57_0.tar.bz2
tar xvjf boost_1_57_0.tar.bz2
mkdir /Users/you/anaconda_boost_install
cd boost_1_57_0
# export PATH=/usr/bin:/bin:/usr/sbin:/sbin: # might be necessary to prevent custom compilers be used
./bootstrap.sh --prefix=/Users/you/anaconda_boost_install/ --with-python=/Users/you/anaconda/bin/python2.7
./b2 link=shared
./b2 link=shared install
# source ~/.bashrc # get back $PATH
fix libboost-python against anaconda:
install_name_tool -id /Users/you/anaconda_boost_install/lib/libboost_python.dylib /Users/you/anaconda_boost_install/lib/libboost_python.dylib
Note: gcc compiler is at /usr/bin/gcc
.
Uncomment below line to use gcc compiler as default compiler:
# export PATH=/usr/bin:/bin:/usr/sbin:/sbin: # might be necessary to prevent custom compilers be used
You can find the complete tutorial here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With