Building graph-tool on CentOS 7

The graph-tool make command on CentOS 7 fails at this point:

$ cd graph-tool-2.2.35
$ ./configure --with-sparsehash-prefix=google
$ make
make all-recursive
make[1]: Entering directory `/home/user/Downloads/graph-tool-2.2.35'
Making all in src

make[4]: Entering directory `/home/user/Downloads/graph-tool-2.2.35/src/graph/topology'
  CXX graph_subgraph_isomorphism.lo
graph_subgraph_isomorphism.cc: In instantiation of 'void get_subgraphs::operator()(const Graph1&, const Graph2*, VertexLabel, boost::any, EdgeLabel, boost::any, std::vector<VertexMap>&, size_t, bool, bool) const [with Graph1 = boost::adj_list<long unsigned int>; Graph2 = boost::adj_list<long unsigned int>; VertexLabel = boost::unchecked_vector_property_map<int, boost::typed_identity_property_map<long unsigned int> >; EdgeLabel = boost::unchecked_vector_property_map<int, boost::adj_edge_index_property_map<long unsigned int> >; VertexMap = boost::checked_vector_property_map<int, boost::typed_identity_property_map<long unsigned int> >; size_t = long unsigned int]':
/usr/include/c++/4.8.2/functional:1305:50: required from '_Result std::_Bind<_Functor(_Bound_args ...)>::__call_c(std::tuple<_Args2 ...>&&, std::_Index_tuple<_Indexes ...>) const [with _Result = void; _Args = {boost::adj_list<long unsigned int>&, boost::adj_list<long unsigned int>*&, boost::unchecked_vector_property_map<int, boost::typed_identity_property_map<long unsigned int> >&, boost::unchecked_vector_property_map<int, boost::adj_edge_index_property_map<long unsigned int> >&}; long unsigned int ..._Indexes = {0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul}; _Functor = get_subgraphs; _Bound_args = {std::_Placeholder<1>, std::_Placeholder<2>, std::_Placeholder<3>, boost::any, std::_Placeholder<4>, boost::any, std::reference_wrapper<std::vector<boost::checked_vector_property_map<int, boost::typed_identity_property_map<long unsigned int> >, std::allocator<boost::checked_vector_property_map<int, boost::typed_identity_property_map<long unsigned int> > > > >, long unsigned int, bool, bool}]’

_descriptor>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::
na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::
na, mpl_::na, mpl_::na, mpl_::na>}]'
graph_subgraph_isomorphism.cc:178:56: required from here
graph_subgraph_isomorphism.cc:108:114: error: 'vf2_subgraph_mono' was not declared in this scope
                                   vertices_equivalent(make_property_map_equivalent(vertex_label1, vertex_label2)));
                                                                                                                  ^

, graph_tool::ConstantPropertyMap<bool, boost::adj_list<long unsigned int>::edge_descriptor>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>}]'
graph_subgraph_isomorphism.cc:178:56: required from here
graph_subgraph_isomorphism.cc:108:114: error: 'vf2_subgraph_mono' was not declared in this scope

Any help fixing this would be greatly appreciated.

I’m building graph-tool from the latest source, graph-tool-2.2.35.tar.bz2. CGAL is built successfully from source (there aren’t any cgal-devel packages yet in the .el7 repos), and because the .el 7 sparsehash-devel package puts its libraries in /usr/include/google, the specific ./configure command for CentOS 7 above is necessary. This runs successfully, and every compile up to graph_subgraph_isomorphism is successful.

The graph-tool make command on CentOS 7 fails at this point:

$ cd graph-tool-2.2.35
$ ./configure --with-sparsehash-prefix=google
$ make
make all-recursive
make[1]: Entering directory `/home/user/Downloads/graph-tool-2.2.35'
Making all in src

make[4]: Entering directory `/home/user/Downloads/graph-tool-2.2.35/src/graph/topology'
  CXX graph_subgraph_isomorphism.lo

[...]

graph_subgraph_isomorphism.cc:108:114: error: 'vf2_subgraph_mono' was not declared in this scope
                                   vertices_equivalent(make_property_map_equivalent(vertex_label1, vertex_label2)));

You need boost version 1.54 or above. Which one do you have installed?

Best,
Tiago

Thank you, Tiago.

Indeed, CentOS 7 server is bundled with boost 1.53. Untangling this on CentOS looks complicated:

$ rpm -e boost-1.53.0-18.el7.x86_64
error: Failed dependencies:
  boost = 1.53.0-18.el7 is needed by (installed) boost-devel-1.53.0-18.el7.x86_64
$ rpm -e boost-devel-1.53.0-18.el7.x86_64
error: Failed dependencies:
  boost-devel is needed by (installed) kdepimlibs-devel-4.10.5-3.el7.x86_64

I suppose I could build the latest 1.56 from source and set some flag to point to that, while keeping the rpm package 1.53 installed.

Any pointers on how to accomplish this while dealing with rpm dependency hell?

Steve

I downloaded boost_1_56_0.tar.gz, built and installed it successfully, then tried this configure statement, which failed.

What is the recommended configure/make options to use a downloaded boost and installed in a nonstandard location?

Here are the steps and result:

# download and build boost using bootstrap.sh
$ sudo mv boost_1_56_0 /usr/local
$ sudo ln -s /usr/local/boost_1_56_0 /usr/local/boost
$ ./configure --with-sparsehash-prefix=google --with-boost=/usr/local/boost --with-boost-libdir=/usr/local/boost/stage/lib
$ make

CXX graph_subgraph_isomorphism.lo

boost::mpl::vector<boost::unchecked_vector_property_map<int, boost::adj_edge_index_property_map<long unsigned int> >, graph_tool::ConstantPropertyMap<bool, boost::adj_list<long unsigned int>::edge_descriptor>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>}]'
graph_subgraph_isomorphism.cc:178:56: required from here
graph_subgraph_isomorphism.cc:108:114: error: 'vf2_subgraph_mono' was not declared in this scope
make[4]: *** [graph_subgraph_isomorphism.lo] Error 1
make[4]: Leaving directory `/home/user/Downloads/graph-tool-2.2.35/src/graph/topology'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/user/Downloads/graph-tool-2.2.35/src/graph'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/user/Downloads/graph-tool-2.2.35/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/user/Downloads/graph-tool-2.2.35'
make: *** [all] Error 2

You still need to inform the compiler and linker where they should
search for libraries, which is done via CPPFLAGS and LDFLAGS:

    ./configure --with-sparsehash-prefix=google CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib"

Assuming that you have installed boost with prefix "/usr/local".

Best,
Tiago

Thanks again Tiago.

No luck so far. I tried both these configuration commands:

./configure --with-sparsehash-prefix=google --with-boost=/usr/local/boost --with-boost-libdir=/usr/local/boost/stage/lib CPPFLAGS="-I/usr/local/include -I/usr/local/boost/libs" LDFLAGS="-L/usr/local/lib -L/usr/local/boost/stage/lib”

and

./configure --with-sparsehash-prefix=google --with-boost=/usr/local/boost --with-boost-libdir=/usr/local/boost/stage/lib CPPFLAGS="-I/usr/local/boost/libs" LDFLAGS=“-L/usr/local/boost/stage/lib"

A dry run of make (make -n) shows the failed compile command:

cd src/graph/topology
echo " CXX " graph_subgraph_isomorphism.lo;/bin/sh ../../../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../.. -I. -I./.. -I./../../boost-workaround -DHAVE_CONFIG_H -I/usr/local/boost/libs -I/usr/include/python2.7 -I/usr/local/boost/include -I/usr/lib64/python2.7/site-packages/numpy/core/include/numpy -I/usr/lib64/python2.7/site-packages/scipy -DSPARSEHASH_PREFIX=google -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-parameter -std=gnu++11 -ftemplate-depth-250 -Wno-deprecated -Wno-unknown-pragmas -O3 -fvisibility=default -fvisibility-inlines-hidden -Wno-unknown-pragmas -DSPARSEHASH_PREFIX=google -MT graph_subgraph_isomorphism.lo -MD -MP -MF .deps/graph_subgraph_isomorphism.Tpo -c -o graph_subgraph_isomorphism.lo graph_subgraph_isomorphism.cc

Error:


st::adj_list<long unsigned int>::edge_descriptor>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>}]'
graph_subgraph_isomorphism.cc:178:56: required from here
graph_subgraph_isomorphism.cc:108:114: error: 'vf2_subgraph_mono' was not declared in this scope

This is happening because the compiler is still finding only the old
boost version, presumably because your are not passing the correct paths
for the new library, which you installed in a non-standard
directory. Verify that the new boost include files are in the directory
"/usr/local/boost/include". If not, adjust CPPFLAGS accordingly.

Best,
Tiago

Thanks Tiago — got it on CentOS 7 now. Until the standard repos update the boost library up to v. 1.54, you build boost yourself from download, stick it in /usr/local with a symbolic link /usr/local/boost that points to it, then run the following configure command for graph-tool. My last mistake was the setting for --with-boost, which wants to point to the top directory.

./configure --with-sparsehash-prefix=google --with-boost=/usr/local/boost --with-boost-libdir=/usr/local/boost/stage/lib CPPFLAGS="-I/usr/local/boost" LDFLAGS="-L/usr/local/boost/stage/lib”
make

This compiles and runs under CentOS 7 now.

Best,

Steve

One more mishap — how to I tell the graph_tool python package where the boost libraries reside? Here’s what happens on import:

$ python -c 'import graph_tool'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/graph_tool/__init__.py", line 101, in <module>
    dl_import("from . import libgraph_tool_core as libcore")
  File "/usr/lib/python2.7/site-packages/graph_tool/dl_import.py", line 57, in dl_import
    exec(import_expr, local_dict, global_dict)
  File "<string>", line 1, in <module>
ImportError: libboost_iostreams.so.1.56.0: cannot open shared object file: No such file or directory

The boost libraries do exist:

$ locate libboost_iostreams.so.1.56.0
/usr/local/boost_1_56_0/bin.v2/libs/iostreams/build/gcc-4.8.2/release/threading-multi/libboost_iostreams.so.1.56.0
/usr/local/boost_1_56_0/stage/lib/libboost_iostreams.so.1.56.0

Thanks again for all your prompt guidance getting this up on a recent OS.

Steve

You should not tell graph-tool itself, but rather the linker
library. This is done via the LD_LIBRARY_PATH environment variable,
which must include the directories to be search. In your case, before
you start the python interpreter, you should do

    export LD_LIBRARY_PATH="/usr/local/boost_1_56_0/stage/lib/"

Best
Tiago

Thanks — that’s it. I had to set it to this to handle a local install of CGAL in /usr/local/lib/libCGAL.so.10.0.3:

export LD_LIBRARY_PATH="/usr/local/lib:/usr/local/boost/stage/lib/"

All is working now.

Steve

I’m having trouble updating load libraries when to the latest version of boost:

$ export LD_LIBRARY_PATH="/usr/local/lib:/usr/local/boost/stage/lib”
$ ipython
In [1]: import graph_tool.all

ImportError: libboost_thread.so.1.57.0: cannot open shared object file: No such file or directory

Why is graph-tool still pointing at the old, nonexistent boost library?? I’m certain I’ve removed the old boost libraries, and sanity checked with the command

$ ( cd / ; sudo updatedb )
$ locate boost | fgrep 1.57
# Empty result

# Remove old graph-tool libraries by hand
$ sudo rm -fr /usr/lib/python2.7/site-packages/graph_tool /usr/lib64/python2.7/site-packages/graph_tool

This really leaves me scratching my head because I’ve expunged boost version 1.57 from everywhere, downloaded/compiled/installed boost version 1.58 from scratch, and configured graph-tool to use all the boost 1.58 directories.

Here’s the setup:

# boost build and install
$ cd /usr/local/boost_1_58_0/
$ sudo ln -s /usr/local/boost_1_58_0 /usr/local/boost
$ ./bootstrap.sh
$ ./b2
$ sudo ./b2 install

# graph-tool build and install
$ cd ~/Downloads/graph-tool-2.2.43/
$ export LD_LIBRARY_PATH="/usr/local/lib:/usr/local/boost/stage/lib”
$ ls -l /usr/local/boost
lrwxrwxr-x. 1 root root 24 Jun 25 12:20 /usr/local/boost -> /usr/local/boost_1_58_0/
$ ./configure --with-sparsehash-prefix=google --with-boost=/usr/local/boost --with-boost-libdir=/usr/local/boost/stage/lib CPPFLAGS="-I/usr/local/boost" LDFLAGS="-L/usr/local/boost/stage/lib"
$ make
$ sudo make install

The boost version is not hard coded into the configure script, so you
must be doing something wrong somewhere. Check which version is actually
linked to the graph-tool binaries with ldd, and also check the output of
configure.log, for more information of what library it is being used.

Best,
Tiago

I hit this issue again and found the fix. I'm posting the steps in case it's
useful to others in the future.

When upgrading (or downgrading) to a new version of Boost, it's necessary to
rebuild the entire stack in order (gcc, Boost, CGAL, graph-tool) by hand on
CentOS. It's also necessary to start with fresh cmake or autoconf
configurations, otherwise, there will be pointers somewhere in the stack to
old Boost versions.

Here's what I did on a fresh CentOS image:

*Necessary Packages and Environment*

sudo -E yum -y groupinstall 'Development Tools'
sudo -E yum -y install python-pip cairomm-devel pycairo-devel bzip2-devel
# dependency troubleshooting
sudo -E yum whatprovides */bzlib.h

export PATH="/usr/local/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/lib64/:/usr/local/boost/stage/lib/"

*gcc*
https://stackoverflow.com/questions/36327805/how-to-install-gcc-5-3-with-yum-on-centos-7-2

cd ~/Downloads
curl ftp://ftp.gnu.org/pub/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
curl ftp://ftp.gnu.org/pub/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2.sig -O
gpg --verify gcc-5.4.0.tar.bz2.sig gcc-5.4.0.tar.bz2
tar xjfp gcc-5.4.0.tar.bz2
cd gcc-5.4.0
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make -j 4
sudo make install
cd
rm -fr ~/Downloads/gcc-5.4.0/
gcc --version
g++ --version

*Boost* http://www.boost.org/users/download/

cd ~/Downloads
tar xfjp boost_1_61_0.tar.bz2
cd boost_1_61_0
./bootstrap.sh
./b2
# make sure latest gcc is in root's PATH
sudo bash -c 'export PATH=/usr/local/bin:$PATH; ./b2 install'
cd ~/Downloads
sudo mv ./boost_1_61_0 /usr/local
sudo ln -s /usr/local/boost_1_61_0 /usr/local/boost
ls -ld /usr/local/boost

# locate old Boost dynamic libraries and rm
sudo bash -c 'cd / ; updatedb'
locate 1.60 | grep boost

*CGAL* https://github.com/CGAL/cgal/releases

tar xfJp CGAL-4.9.tar.xz
cd CGAL-4.9
cmake .
make
sudo bash -c 'export PATH=/usr/local/bin:$PATH; make install'

*graph-tool* https://graph-tool.skewed.de/

cd ~/Downloads
tar xfjp graph-tool-2.18.tar.bz2
cd graph-tool-2.18
./configure --with-sparsehash-prefix=google --with-boost=/usr/local/boost
--with-boost-libdir=/usr/local/boost/stage/lib CPPFLAGS="-I/usr/local/boost"
LDFLAGS="-L/usr/local/boost/stage/lib"
less config.log # Make sure graph-tool points at the correct boost
directories
make
sudo make install
cd

# CentOS issues with matplotlib versions,
https://stackoverflow.com/questions/33720656/python-2-import-error-cannot-import-name-unpack-labeled-data/

sudo -E pip uninstall matplotlib
sudo -E pip uninstall matplotlib
sudo -E pip install --upgrade matplotlib
sudo -E yum -y install python

ipython

import graph_tool.all as gt
g = gt.Graph()
v = g.add_vertex()
u = g.add_vertex()
e = g.add_edge(v,u)
gt.graph_draw(g)