boost errors building on Mac OSX

Hi all,

I've been trying to build graph-tool on my Mac (10.7.2) for the past few
days. The issues occur with graph-tool-2.2.15 (though I've also had issues
with the lastest code from github). At this point I have reached a bit of a
dead end. Looking at what I posted below, does anyone have any suggestions??
Many thanks!!

Jesse

Here is my configure command:

./configure --enable-openmp --with-boost-python=boost_python_mt
--with-numpy=/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/numpy
--with-scipy=/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/scipy
LDFLAGS=-L/opt/local/lib CXXFLAGS="-I/opt/local/include"

The additional args stem from the fact that I'm using the Enthought python
distribution and macports, both of which put stuff in non-standard places it
seems. The graph-tool build error is related to boost, which I installed
using macports (version 1.47) . So I doubt my problems have to do with
Enthought.

Now, here's the compiler/make output:

jberwald(a)hyperion:~/src/graph-tool-2.2.15$ make
make all-recursive
Making all in src
Making all in graph
Making all in centrality
  CXX graph_betweenness.lo
  CXX graph_centrality_bind.lo
  CXX graph_eigentrust.lo
  CXX graph_eigenvector.lo
  CXX graph_pagerank.lo
  CXX graph_trust_transitivity.lo
  CXXLD libgraph_tool_centrality.la
Making all in clustering
  CXX graph_clustering.lo
  CXX graph_extended_clustering.lo
  CXX graph_motifs.lo
graph_motifs.hh: In member function 'void
graph_tool::get_all_motifs::operator()(Graph&, size_t, boost::any&,
std::vector<long unsigned int, std::allocator&lt;long unsigned int> >&,
Sampler, double, bool, bool, graph_tool::rng_t&) const [with Graph =
boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
boost::no_property, boost::property&lt;boost::edge_index_t, long unsigned
int, boost::no_property>, boost::no_property, boost::listS>, Sampler =
graph_tool::sample_all]':
graph_motifs.hh:415: internal compiler error: in lower_stmt, at
gimple-low.c:319
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter&gt; for instructions.
make[4]: *** [graph_motifs.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Also, I attempted to install from macports originally. But macports tells me
the following:

Error: Cannot install py27-graph-tool for the arch(s) 'i386 x86_64' because

Hi Jesse,

Here is my configure command:

./configure --enable-openmp --with-boost-python=boost_python_mt
--with-numpy=/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/numpy
--with-scipy=/Library/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages/scipy
LDFLAGS=-L/opt/local/lib CXXFLAGS="-I/opt/local/include"

[...]

graph_motifs.hh:415: internal compiler error: in lower_stmt, at
gimple-low.c:319
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter&gt; for instructions.

An internal compiler error is always a bug in the compiler... This was
caused because apple's GCC has broken support for OpenMP. Try again with
the --disable-openmp option, and it should work.

Also, I attempted to install from macports originally. But macports tells me
the following:

Error: Cannot install py27-graph-tool for the arch(s) 'i386 x86_64' because

Error: its dependency py27-scipy does not build for the required
arch(s) by default
Error: and does not have a universal variant.
Error: Unable to execute port: architecture mismatch

It would be nice to submit a bug report to the macports people about
this. Maybe they can fix the scipy portfile to allow an universal build.
You can file a bug report here: Available Reports – MacPorts

Cheers,
Tiago

Disabling openmp worked. Thanks. Unfortunately, there are still
architecture issues. After installing ("make install"), the following error
occurred when attempting to import graph-tool:

In [1]: import graph_tool

attachment.html (7.17 KB)

ImportError: dlopen(/usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so, 9): no suitable image found. Did find:
/usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so: mach-o, but wrong architecture

These architecture issues on Mac are mystifying to me. How can
something be built for the wrong architecture if I just compiled it
for that architecture? sigh... Thanks any help you can provide.

I have very little experience with building stuff with multiple
architectures with apple's GCC, but according to the documentation you
should pass something like "-arch i386 -arch x86_64" to the compiler to
generate "universal" binaries. From the ./configure command you sent in
the first email, it did not seem you passed this. Hence you should try
something like:

    ./configure CXXFLAGS="-arch i386 -arch x86_64 -I/opt/local/include" <..your other options..>

I hope it helps.

Cheers,
Tiago

Thank you. I too have very little experience with Mac's multiple
architecture concept. (This would have been done days ago in Linux. argh!)
Sadly, the plot thickens. After including the two -arch flags and running
configure, the compiler gets tripped up immediately. It appears that
multiple architectures are not supports with many compiler options(?):

make all-recursive
Making all in src
Making all in graph
Making all in centrality
  CXX graph_betweenness.lo
llvm-g++-4.2: -E, -S, -save-temps and -M options are not allowed with
multiple -arch flags
make[4]: *** [graph_betweenness.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Jesse

attachment.html (5.22 KB)

I noticed that gcc 4.4 is required for compilation. I know that Mac likes
to tweak gcc. Does this mean that llvm-g++-4.2 is too old? I could install
the normal version of gcc4.6 which is the latest in macports.

attachment.html (5.81 KB)

  CXX graph_betweenness.lo
llvm-g++-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
make[4]: *** [graph_betweenness.lo] Error 1

I'm stumped on this... I'd have to investigate further. But I notice you
are using llvm-g++. Maybe you should try the regular (non-llvm) g++?

I noticed that gcc 4.4 is required for compilation. I know that Mac
likes to tweak gcc. Does this mean that llvm-g++-4.2 is too old? I
could install the normal version of gcc4.6 which is the latest in
macports.

Apple's GCC version 4.2 without OpenMP compiles graph-tool without a
problem. Of course, FSF's "stock" gcc from macports compiles it as well,
but for some reason things which are compiled with it do not work well
with the rest of the system compiled with Apple's GCC (strange
segfaults, etc)... Just one of the very many MacOS annoying
peculiarities.

Cheers,
Tiago

Macports has "resolved" the bug with scipy-universal built. Unfortunately,
scipy is compiled with compilers that cannot produce universal variants. I
figure my next step will be to either a) make sure everything python is
compiled for 64-bit; or b) switch back to linux and get it working in 5
minutes. sigh...

thanks for your help,
Jesse

attachment.html (4.67 KB)

hi,

You can build a universal scipy fairly easily with macports- look at the
attachments on

https://trac.macports.org/ticket/19397

It's a mystery to me why macports doesn't include these patches to have
scipy build universal, but the patches work just fine for me…

With regards to your issue with compiling for multiple archs (save-temps
and -M options)- you might try passing "--disable-dependency-tracking" to
the configure script.

attachment.html (6.17 KB)