Osx conda install boost compiled with gcc

I am trying to install boost using anaconda in osx. In particular, it should be linked with gcc (instead of osx default clang ). Does anyone know how to do this or if it is possible even with conda? Ideally, I would like two separate boost libraries, one compiled with gcc and one with clang .

+5
source share
1 answer

Edited by:

Assuming anaconda is installed in

 /Users/you/anaconda 

the following steps should allow you to compile boost with python using the 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 vs anaconda:

 install_name_tool -id /Users/you/anaconda_boost_install/lib/libboost_python.dylib /Users/you/anaconda_boost_install/lib/libboost_python.dylib 

Note. The gcc compiler is located in /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 full tutorial here .

+2
source

Source: https://habr.com/ru/post/1011900/


All Articles