Installing graph-tool on Mac OS X (10.7) - already have Boost installed, but keep getting this error

boost, c++, installation, macos, python

Solution

Hooray, my first chance to give back to Stack Overflow! I've been dealing with this issue myself the past 2 days.

Solution

Upgrade clang via Xcode

Make a symlink to boost that includes the version number

/usr/local/include/boost-1_55.0 -> ../Cellar/boost/1.55.0/include/boost

(included because I installed Boost using Brew and had this issue)

Edit the generation of CXXFLAGS in configure so that it looks like this:

old_cxxflags="$CXXFLAGS" CXXFLAGS="${CXXFLAGS} -std=gnu++11 -stdlib=libc++" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler supports -std=gnu++11" >&5 $as_echo_n "checking whether C++ compiler supports -std=gnu++11... " >&6; }

Run

./configure --disable-sparsehash CXX="/usr/bin/clang++" PYTHON_EXTRA_LDFLAGS="-L/usr/local/bin"

Versions

OS: Mac OS X 10.8.5 Clang: Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin12.5.0 Thread model: posix Graph-tool: 2.2.29.1 Boost: 1.55.0

Explanation

If you go through the configure code and try and compile the confdefs.h files made in configure, you'll see clang error out upon encountering the -Wno-unused-local-typedefs flag. This is the actual cause of the "We could not detect the boost libraries (version 1.33 or higher)" error, not the fact that it can't find the boost files. This issue is fixed with newer versions of clang.

The configure test for version number is goofy. It expects the boost include directory to contain the version number.

While running make, you may run into the following errors:

./../graph_adjacency.hh:26:10: fatal error: 'tuple' file not found

This is caused by referencing the wrong standard library [1]

./../graph_adaptor.hh:655:39: error: expected ';' in 'for' statement specifier  
    for(typeof(removed_edges.begin()) iter = removed_edges.begin();  
./../graph_adaptor.hh:655:39: error: use of undeclared identifier 'tier'  

This is caused by referencing the wrong C++ standard (c++11 instead of gnu++11)

References

[1] No member named 'forward' in namespace 'std' [2] I'm having some trouble with C++11 in Xcode

Problem

I've been stuck on this issue for a while now. I'm trying to install graph-tool - http://graph-tool.skewed.de/download#macos - and I have the prereqs from following these steps, which the graph-tool site links to: https://gist.github.com/openp2pdesign/8864593 Instead of brew install, which didn't seem to give me all the files, I went to Boost's official site and downloaded from there properly, following these steps: http://www.boost.org/doc/libs/1_41_0/more/getting_started/unix-variants.html It's mainly getting a tar file and untarring it. I then put my boost install here: ``` /usr/local/boost_1_55_0 ``` I did a small C++ example and confirmed Boost works (using "Build a Simple Program Using Boost" from http://www.boost.org/doc/libs/1_41_0/more/getting_started/unix-variants.html. Now the meat of the problem: trying to install graph-tool. In the very last step, I do ``` ./configure PYTHON_EXTRA_LDFLAGS="-L/usr/local/bin" ``` (The PYTHON_EXTRA_LDFLAGS="-L/usr/local/bin" just makes the configure script find Python alright.) But I get this error. (It finds Python fine, but not boost!) ``` ... ================ Detecting python ================ checking for a Python interpreter with version >= 2.6... python checking for python... /Users/daze/Library/Enthought/Canopy_64bit/User/bin/python checking for python version... 2.7 checking for python platform... darwin checking for python script directory... ${prefix}/lib/python2.7/site-packages checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-packages checking for python2.7... (cached) /Users/daze/Library/Enthought/Canopy_64bit/User/bin/python checking for a version of Python >= '2.1.0'... yes checking for a version of Python == '2.7.3'... yes checking for the distutils Python package... yes checking for Python include path... -I/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/include/python2.7 checking for Python library path... -L/Applications/Canopy.app/appdata/canopy-1.1.0.1371.macosx-x86_64/Canopy.app/Contents/lib/python2.7/config -lpython2.7 checking for Python site-packages path... /Users/daze/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages checking python extra libraries... -ldl -framework CoreFoundation checking python extra linking flags... -L/usr/local/bin checking consistency of all components of python development environment... yes graph-tool will be installed at: /Users/daze/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages =========================== Using python version: 2.7.3 =========================== checking for boostlib >= 1.38.0... configure: error: We could not detect the boost libraries (version 1.38 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation. ``` Attempt 2: I then tried setting BOOST_ROOT properly: In my ~/.bash_profile: ``` export BOOST_ROOT="/usr/local/boost_1_55_0" ``` But it still did no good, so I unset that. Attempt 3: I then tried explicitly specifying where boost is installed: ``` ./configure --with-boost="/usr/local/boost_1_55_0" PYTHON_EXTRA_LDFLAGS="-L/usr/local/bin" ``` But it still can't find boost, and yields that same error in the end of "We could not detect the boost libraries (version 1.38 or higher)." It's been bugging me all day. I've read carefully, and went to the randspringer.de/boost site and saw this in the FAQ - http://www.randspringer.de/boost/faq.html#id2514912: Q: I do not understand the configure error message At configure time I get: checking for boostlib >= 1.33... configure: error: We could not detect the boost libraries (version 1.33 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation. I don't know if I use a staged version of boost. What is it and what can I do ? A: If you did not compile Boost by yourself you don't have a staged version and you don't have to set BOOST_ROOT. Look here for an explanation of different kind of installations. If you are sure you have Boost installed then specify the directory with ./configure --with-boost=your-boost-directory. If it still does not work, please check the version number in boost/version.hpp and compare it with the version requested in configure.ac. And I don't know what to see when comparing version numbers. There's nothing I found interesting there. Hoping someone has at least an idea on what other approaches to take.

Original source

Related problems