Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

osx conda install boost compiled with gcc

Tags:

macos

conda

boost

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.

like image 282
kilojoules Avatar asked Oct 30 '22 17:10

kilojoules


1 Answers

Edited:

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.

like image 169
youhans Avatar answered Nov 15 '22 08:11

youhans