graph-tool 1.1.2 on macbook with mac os 10.4.11

Hi all,

I'm trying to compile graph-tool on a macbook with mac os x v10.4.11,
but compilation fails as follows:

  /opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2 -DHAVE_CONFIG_H -
I. -I../.. -I. -I.. -I../boost-workaround -DHAVE_CONFIG_H -Wall -I/
opt/local/include/python2.5 -pthread -I/opt/local/include/
boost-1_34_1 -ftemplate-depth-150 -O99 -Wno-unknown-pragmas -MT
graph.lo -MD -MP -MF .deps/graph.Tpo -c graph.cc -fno-common -DPIC -
o .libs/graph.o
graph.cc: In function 'void catch_sig_stop(int)':
graph.cc:560: error: 'SIGPWR' was not declared in this scope
graph.cc: In member function 'void
graph_tool::GraphInterface::InitSignalHandling()':
graph.cc:593: error: 'SIGPWR' was not declared in this scope
make[3]: *** [graph.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

My system is:
python v2.5.1
gcc v4.2.2
boost v1.34.1

I'm using the following configure command:
sudo ./configure --prefix=/opt/local --with-boost=/opt/local --
disable-visibility CC=/opt/local/bin/i386-apple-darwin8.11.1-
gcc-4.2.2 CXX=/opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2
PYTHON_VERSION=2.5 LDFLAGS=-L/opt/local/lib/

Any ideas?

Thanks,

Spiros

Hi all,

I'm trying to compile graph-tool on a macbook with mac os x v10.4.11,
but compilation fails as follows:

[...]

graph.cc:560: error: 'SIGPWR' was not declared in this scope

[...]

Any ideas?

Oops. Looks like SIGPWR is not defined in MacOS X. I've committed a fix
for this in the git repository. Please get the newest git version, and
see if you have any trouble now.

Thanks for the bug report.

Tiago

Thanks! This is fixed now, but there's another problem later on. It
seems that the linker on mac os x v10.4.11 does not support the '-E'
option. Here's the error I get:

/usr/bin/ld: unknown flag: -E

I'm not sure what I need to change to eliminate this option, if
possible. Could you please help?

Thanks,

Spiros

Do you know what linker is used in MacOS X? Could you please send me the
output of ld --version (or the equivalent for this linker)?

Cheers,
Tiago

Sorry for not sending this earlier. I'm not sure that it helps, but
here it is:

spirosspirou$ /usr/bin/ld -v
Apple Computer, Inc. version cctools-622.5.obj~13

Is the '-E' option really necessary? Could we just remove it from the
LDFLAGS for darwin? (Problem is, I don't know how to do this :slight_smile: ).

Thanks,

Spiros

The behaviour of the '-E' flag in GNU ld is necessary to export all
dynamic symbols, which is not done by default. So indeed we need this,
since the run_action() functionality, which compiles and loads C++ code
from python at run time, needs all symbols to be exported properly. I
looked at apple's (darwin) ld manpage, http://www.hmug.org/man/1/ld.php,
and at first glance, found no equivalent option. So I'm just going to
drop this for any liker that doesn't support the option, and hope it
will do what we want by default. The git version already contains this
fix. Please tell me if it compiles for you now...

Cheers,
Tiago

Hi Tiago,

Thanks! This is fixed now, but there's another problem later on. It
seems that the linker on mac os x v10.4.11 does not support the
'-E'
option. Here's the error I get:

/usr/bin/ld: unknown flag: -E

I'm not sure what I need to change to eliminate this option, if
possible. Could you please help?

Do you know what linker is used in MacOS X? Could you please
send me the
output of ld --version (or the equivalent for this linker)?

Sorry for not sending this earlier. I'm not sure that it helps,
but here it is:
spirosspirou$ /usr/bin/ld -v
Apple Computer, Inc. version cctools-622.5.obj~13
Is the '-E' option really necessary? Could we just remove it from the
LDFLAGS for darwin? (Problem is, I don't know how to do this :slight_smile: ).

The behaviour of the '-E' flag in GNU ld is necessary to export all
dynamic symbols, which is not done by default. So indeed we need this,
since the run_action() functionality, which compiles and loads C++
code
from python at run time, needs all symbols to be exported properly. I
looked at apple's (darwin) ld manpage, http://www.hmug.org/man/1/
ld.php,
and at first glance, found no equivalent option. So I'm just going to
drop this for any liker that doesn't support the option, and hope it
will do what we want by default. The git version already contains this
fix. Please tell me if it compiles for you now...

Thank you for the prompt response! This release got me further, but
I've hit another wall that looks scary. Here it is:

vtable for __cxxabiv1::__function_type_info
std::range_error::range_error(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)
collect2: ld returned 1 exit status
make[3]: *** [libgraph_tool.la] Error 1

Is it that some prototypes do not match? I'm really clueless...

Cheers,

Spiros

Strange... Could you please send me the full compilation output
attached? Also, what version of GCC are you using?

Cheers,
Tiago

Hi Tiago,

Thank you for the prompt response! This release got me further,
but I've hit another wall that looks scary. Here it is:
vtable for __cxxabiv1::__function_type_info
std::range_error::range_error(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)
collect2: ld returned 1 exit status
make[3]: *** [libgraph_tool.la] Error 1
Is it that some prototypes do not match? I'm really clueless...

Strange... Could you please send me the full compilation output
attached?

Attached.

It seems that the linker has unresolved symbols. I tried configuring
the path to libstdc++ ('-L/opt/local/lib/gcc42') in LDFLAG, but I get
the same error.

Also, what version of GCC are you using?

4.2.2

Cheers,

Spiros

graph-tool_make_output.txt (77.9 KB)

The compiler is not linking to the standard C++ library and to the zlib
and bzip2 libraries, and all the dynamic symbols are turning up
unresolved. libtool was supposed to handle all this... Please try the
following link command in the src/graph/ directory, and tell me the
result:

/bin/sh ../../libtool --tag=CXX --mode=link /opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2 -Wall -I/opt/local/include/python2.5 -pthread -I/opt/local/include/boost-1_34_1 -ftemplate-depth-150 -O99 -Wno-unknown-pragmas -module -avoid-version -export-dynamic -no-undefined -L/opt/local/lib/ -o libgraph_tool.la -rpath /opt/local/lib/python2.5/site-packages/graph_tool graph.lo graph_python_interface.lo graph_properties.lo graph_correlations.lo graph_edge_correlations.lo graph_correlations_combined.lo graph_correlations_neighbours.lo graph_assortativity.lo graph_clustering.lo graph_extended_clustering.lo graph_generation.lo graph_distance.lo graph_distance_sampled.lo graph_reciprocity.lo graph_minimum_spanning_tree.lo graph_community.lo graph_community_network.lo graph_line_graph.lo graph_betweenness.lo graph_rewiring.lo graph_layout.lo graph_io.lo graph_bind.lo graphml.lo read_graphviz_spirit.lo -L/opt/local/lib/python2.5 -lpython2.5 -L/opt/local/lib -lboost_python -lboost
_iostreams -lexpat -lz -lbzip2 -lstdc++

Cheers,
Tiago

Hi Tiago,

Thanks for the support so far!

Hi Tiago,

Thank you for the prompt response! This release got me further,
but I've hit another wall that looks scary. Here it is:
vtable for __cxxabiv1::__function_type_info
std::range_error::range_error(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)
collect2: ld returned 1 exit status
make[3]: *** [libgraph_tool.la] Error 1
Is it that some prototypes do not match? I'm really clueless...

Strange... Could you please send me the full compilation output
attached?

Attached.
---------------------------------------------------------------------
It seems that the linker has unresolved symbols. I tried configuring
the path to libstdc++ ('-L/opt/local/lib/gcc42') in LDFLAG, but I get
the same error.

The compiler is not linking to the standard C++ library and to the
zlib
and bzip2 libraries, and all the dynamic symbols are turning up
unresolved. libtool was supposed to handle all this... Please try the
following link command in the src/graph/ directory, and tell me the
result:

/bin/sh ../../libtool --tag=CXX --mode=link /opt/local/bin/i386-
apple-darwin8.11.1-gcc-4.2.2 -Wall -I/opt/local/include/python2.5 -
pthread -I/opt/local/include/boost-1_34_1 -ftemplate-depth-150 -
O99 -Wno-unknown-pragmas -module -avoid-version -export-dynamic -
no-undefined -L/opt/local/lib/ -o libgraph_tool.la -rpath /opt/
local/lib/python2.5/site-packages/graph_tool graph.lo
graph_python_interface.lo graph_properties.lo graph_correlations.lo
graph_edge_correlations.lo graph_correlations_combined.lo
graph_correlations_neighbours.lo graph_assortativity.lo
graph_clustering.lo graph_extended_clustering.lo
graph_generation.lo graph_distance.lo graph_distance_sampled.lo
graph_reciprocity.lo graph_minimum_spanning_tree.lo
graph_community.lo graph_community_network.lo graph_line_graph.lo
graph_betweenness.lo graph_rewiring.lo graph_layout.lo graph_io.lo
graph_bind.lo graphml.lo read_graphviz_spirit.lo -L/opt/local/lib/
python2.5 -lpython2.5 -L/opt/local/lib -lboost_python -lboost
_iostreams -lexpat -lz -lbzip2 -lstdc++

Here it is:

/opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2 -o .libs/
libgraph_tool.so -bundle .libs/graph.o .libs/
graph_python_interface.o .libs/graph_properties.o .libs/
graph_correlations.o .libs/graph_edge_correlations.o .libs/
graph_correlations_combined.o .libs/
graph_correlations_neighbours.o .libs/graph_assortativity.o .libs/
graph_clustering.o .libs/graph_extended_clustering.o .libs/
graph_generation.o .libs/graph_distance.o .libs/
graph_distance_sampled.o .libs/graph_reciprocity.o .libs/
graph_minimum_spanning_tree.o .libs/graph_community.o .libs/
graph_community_network.o .libs/graph_line_graph.o .libs/
graph_betweenness.o .libs/graph_rewiring.o .libs/graph_layout.o .libs/
graph_io.o .libs/graph_bind.o .libs/graphml.o .libs/
read_graphviz_spirit.o -L/opt/local/lib/ -L/opt/local/lib/python2.5 -
lpython2.5 -L/opt/local/lib -lboost_python -lboost /opt/local/lib/
libexpat.dylib -lz -lbzip2 /opt/local/lib/gcc42/libstdc++.dylib -L/
opt/local/var/macports/build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src -L/opt/local/
var/macports/build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src/.libs -pthread
/usr/bin/ld: warning -L: directory name (/opt/local/var/macports/
build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src) does not exist
/usr/bin/ld: warning -L: directory name (/opt/local/var/macports/
build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src/.libs) does
not exist
/usr/bin/ld: can't locate file for: -lboost
collect2: ld returned 1 exit status

Cheers,

Spiros

Hi Tiago,

Thanks for the support so far!

It's quite alright. :slight_smile:

/usr/bin/ld: can't locate file for: -lboost
collect2: ld returned 1 exit status

I think -lboost_iostreams got broken with a line break in the command
line. Could you please try again?

Cheers,
Tiago

My mistake. Here's the correct output:

/opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2 -o .libs/
libgraph_tool.so -bundle .libs/graph.o .libs/
graph_python_interface.o .libs/graph_properties.o .libs/
graph_correlations.o .libs/graph_edge_correlations.o .libs/
graph_correlations_combined.o .libs/
graph_correlations_neighbours.o .libs/graph_assortativity.o .libs/
graph_clustering.o .libs/graph_extended_clustering.o .libs/
graph_generation.o .libs/graph_distance.o .libs/
graph_distance_sampled.o .libs/graph_reciprocity.o .libs/
graph_minimum_spanning_tree.o .libs/graph_community.o .libs/
graph_community_network.o .libs/graph_line_graph.o .libs/
graph_betweenness.o .libs/graph_rewiring.o .libs/graph_layout.o .libs/
graph_io.o .libs/graph_bind.o .libs/graphml.o .libs/
read_graphviz_spirit.o -L/opt/local/lib/ -L/opt/local/lib/python2.5 -
lpython2.5 -L/opt/local/lib -lboost_python -lboost_iostreams /opt/
local/lib/libexpat.dylib -lz -lbzip2 /opt/local/lib/gcc42/libstdc+
+.dylib -L/opt/local/var/macports/build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src -L/opt/local/
var/macports/build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src/.libs -pthread
/usr/bin/ld: warning -L: directory name (/opt/local/var/macports/
build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src) does not exist
/usr/bin/ld: warning -L: directory name (/opt/local/var/macports/
build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src/.libs) does
not exist
/usr/bin/ld: can't locate file for: -lbzip2
collect2: ld returned 1 exit status

I have something called libbz2 in /opt/local/lib. Is this the bzip2
library?

Cheers,

Spiros

Yes, this is it. Please change -lbzip2 to -lbz2 and try again.
Cheers.

OK, here's what I got:

/opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2 -o .libs/
libgraph_tool.so -bundle .libs/graph.o .libs/
graph_python_interface.o .libs/graph_properties.o .libs/
graph_correlations.o .libs/graph_edge_correlations.o .libs/
graph_correlations_combined.o .libs/
graph_correlations_neighbours.o .libs/graph_assortativity.o .libs/
graph_clustering.o .libs/graph_extended_clustering.o .libs/
graph_generation.o .libs/graph_distance.o .libs/
graph_distance_sampled.o .libs/graph_reciprocity.o .libs/
graph_minimum_spanning_tree.o .libs/graph_community.o .libs/
graph_community_network.o .libs/graph_line_graph.o .libs/
graph_betweenness.o .libs/graph_rewiring.o .libs/graph_layout.o .libs/
graph_io.o .libs/graph_bind.o .libs/graphml.o .libs/
read_graphviz_spirit.o -L/opt/local/lib/ -L/opt/local/lib/python2.5 -
lpython2.5 -L/opt/local/lib -lboost_python -lboost_iostreams /opt/
local/lib/libexpat.dylib -lz -lbz2 /opt/local/lib/gcc42/libstdc+
+.dylib -L/opt/local/var/macports/build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src -L/opt/local/
var/macports/build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src/.libs -pthread
/usr/bin/ld: warning -L: directory name (/opt/local/var/macports/
build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src) does not exist
/usr/bin/ld: warning -L: directory name (/opt/local/var/macports/
build/
_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gc
c42/work/build/i386-apple-darwin8.11.1/libstdc++-v3/src/.libs) does
not exist
/usr/bin/ld: Undefined symbols:
__Unwind_Resume
collect2: ld returned 1 exit status

S.

OK, here's what I got:

/opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2 -o .libs/

(...)

/usr/bin/ld: Undefined symbols:
__Unwind_Resume
collect2: ld returned 1 exit status

It just occurred to me that the gcc binary is being used to link the
library, not g++! That's probably the reason of all these undefined
references... In your first message, I saw you ran configure with
CXX=/opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2. This is
incorrect. You needed to do something like
CXX=/opt/local/bin/i386-apple-darwin8.11.1-g++-4.2.2, assuming that's
what g++ is called on your system. Please try a whole build from
scratch, using g++ this time, and see if you still encounter any
problems.

Cheers,
Tiago

Hi Tiago,

It just occurred to me that the gcc binary is being used to link the
library, not g++! That's probably the reason of all these undefined
references... In your first message, I saw you ran configure with
CXX=/opt/local/bin/i386-apple-darwin8.11.1-gcc-4.2.2. This is
incorrect. You needed to do something like
CXX=/opt/local/bin/i386-apple-darwin8.11.1-g++-4.2.2, assuming that's
what g++ is called on your system. Please try a whole build from
scratch, using g++ this time, and see if you still encounter any
problems.

I thought that gcc is just the front-end to the compilers underneath.
Thanks for your patience so far...

I did what you suggested, but I still get undefined symbols, although
different ones. Strangely, these seem to be related to libbz2, which
is in /opt/local/lib. Here's the output:

/bin/sh ../../libtool --tag=CXX --mode=compile /opt/local/bin/i386-
apple-darwin8.11.1-g++-mp-4.2 -DHAVE_CONFIG_H -I. -I../.. -I. -I.. -
I../boost-workaround -DHAVE_CONFIG_H -Wall -I/opt/local/include/
python2.5 -pthread -I/opt/local/include/boost-1_34_1 -ftemplate-
depth-150 -O99 -Wno-unknown-pragmas -MT read_graphviz_spirit.lo -MD
-MP -MF .deps/read_graphviz_spirit.Tpo -c -o read_graphviz_spirit.lo
read_graphviz_spirit.cpp
  /opt/local/bin/i386-apple-darwin8.11.1-g++-mp-4.2 -DHAVE_CONFIG_H -
I. -I../.. -I. -I.. -I../boost-workaround -DHAVE_CONFIG_H -Wall -I/
opt/local/include/python2.5 -pthread -I/opt/local/include/
boost-1_34_1 -ftemplate-depth-150 -O99 -Wno-unknown-pragmas -MT
read_graphviz_spirit.lo -MD -MP -MF .deps/read_graphviz_spirit.Tpo -c
read_graphviz_spirit.cpp -fno-common -DPIC -o .libs/
read_graphviz_spirit.o
mv -f .deps/read_graphviz_spirit.Tpo .deps/read_graphviz_spirit.Plo
/bin/sh ../../libtool --tag=CXX --mode=link /opt/local/bin/i386-
apple-darwin8.11.1-g++-mp-4.2 -Wall -I/opt/local/include/python2.5 -
pthread -I/opt/local/include/boost-1_34_1 -ftemplate-depth-150 -O99
-Wno-unknown-pragmas -module -avoid-version -export-dynamic -no-
undefined -L/opt/local/lib/ -L/opt/local/lib/gcc42 -o
libgraph_tool.la -rpath /opt/local/lib/python2.5/site-packages/
graph_tool graph.lo graph_python_interface.lo graph_properties.lo
graph_correlations.lo graph_edge_correlations.lo
graph_correlations_combined.lo graph_correlations_neighbours.lo
graph_assortativity.lo graph_clustering.lo
graph_extended_clustering.lo graph_generation.lo graph_distance.lo
graph_distance_sampled.lo graph_reciprocity.lo
graph_minimum_spanning_tree.lo graph_community.lo
graph_community_network.lo graph_line_graph.lo graph_betweenness.lo
graph_rewiring.lo graph_layout.lo graph_io.lo graph_bind.lo
graphml.lo read_graphviz_spirit.lo -L/opt/local/lib/python2.5 -
lpython2.5 -L/opt/local/lib -lboost_python -lboost_iostreams -lexpat
/opt/local/bin/i386-apple-darwin8.11.1-g++-mp-4.2 -o .libs/
libgraph_tool.so -bundle .libs/graph.o .libs/
graph_python_interface.o .libs/graph_properties.o .libs/
graph_correlations.o .libs/graph_edge_correlations.o .libs/
graph_correlations_combined.o .libs/
graph_correlations_neighbours.o .libs/graph_assortativity.o .libs/
graph_clustering.o .libs/graph_extended_clustering.o .libs/
graph_generation.o .libs/graph_distance.o .libs/
graph_distance_sampled.o .libs/graph_reciprocity.o .libs/
graph_minimum_spanning_tree.o .libs/graph_community.o .libs/
graph_community_network.o .libs/graph_line_graph.o .libs/
graph_betweenness.o .libs/graph_rewiring.o .libs/graph_layout.o .libs/
graph_io.o .libs/graph_bind.o .libs/graphml.o .libs/
read_graphviz_spirit.o -L/opt/local/lib/ -L/opt/local/lib/gcc42 -L/
opt/local/lib/python2.5 -lpython2.5 -L/opt/local/lib -lboost_python -
lboost_iostreams /opt/local/lib/libexpat.dylib -pthread
/usr/bin/ld: Undefined symbols:
_crc32
_deflate
_deflateEnd
_deflateInit2_
_deflateReset
_inflate
_inflateEnd
_inflateInit2_
_inflateReset
_BZ2_bzCompress
_BZ2_bzCompressEnd
_BZ2_bzCompressInit
_BZ2_bzDecompress
_BZ2_bzDecompressEnd
_BZ2_bzDecompressInit
collect2: ld returned 1 exit status
make[3]: *** [libgraph_tool.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Thanks,

Spiros

Try the link with -lbz2 and -lz. You can set LDFLAGS to "-lbz2 -lz" when
issuing configure. I don't know why it is trying to link to those
libraries directly, since graph_tool uses them only through
boost_iostreams, and we're making a dynamic library. I suspect this must
be related either to the way things are linked in MacOS X, or maybe how
things are installed on your system, I'm not sure. If this works, I'll
add "-lbz2 -lz" to graph_tool build by default, since it doesn't really
hurt.

Cheers,
Tiago

Hi Tiago,

Try the link with -lbz2 and -lz. You can set LDFLAGS to "-lbz2 -lz"
when
issuing configure. I don't know why it is trying to link to those
libraries directly, since graph_tool uses them only through
boost_iostreams, and we're making a dynamic library. I suspect this
must
be related either to the way things are linked in MacOS X, or maybe
how
things are installed on your system, I'm not sure. If this works, I'll
add "-lbz2 -lz" to graph_tool build by default, since it doesn't
really
hurt.

This looked better:

(cd .libs && rm -f libgraph_tool.la && ln -s ../libgraph_tool.la
libgraph_tool.la)
Making all in graph_tool
make[3]: Nothing to be done for `all'.
Making all in .
make[3]: Nothing to be done for `all-am'.
make[2]: Nothing to be done for `all-am'.

But, when I did 'graph-tool --help', here's what I got:

   File "/opt/local/bin/graph-tool", line 128
     return "|".join(metavars) if len(metavars) > 0 else None
                                ^
SyntaxError: invalid syntax

Cheers,

S.

Are you sure you are using python 2.5? What is the result of 'python
--version'?

Cheers,
Tiago