building graph-tool 2.0 under Mac OS X

Hi,

I'm trying to build graph-tool (from git) under my Mac OS X 10.4. I
have installed through macports the libboost 1.40 (and boost::python
support for python2.6).

The configure script chooses to build for python 2.5, and therefore it
cannot find boost::python
Here's the configure output:

checking for a Python interpreter with version >= 2.5... python
checking for python... /opt/local/bin/python
checking for python version... 2.6
checking for python platform... darwin
checking for python script directory... ${prefix}/lib/python2.6/site-packages
checking for python extension module directory...
${exec_prefix}/lib/python2.6/site-packages
checking for python2.6... (cached) /opt/local/bin/python
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python 2.5... yes
checking for the distutils Python package... yes
checking for Python include path...
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
checking for Python library path...
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
-lpython2.6
checking for Python site-packages path...
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
checking python extra libraries... -ldl
checking python extra linking flags... -u _PyMac_Error
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python
checking consistency of all components of python development environment... yes
checking for boostlib >= 1.33.1... yes
checking for python build information...
checking for python2.5... python2.5
checking for main in -lpython2.5... yes
checking python2.5/Python.h usability... yes
checking python2.5/Python.h presence... yes
checking for python2.5/Python.h... yes
  results of the Python check:
    Binary: python2.5
    Library: python2.5
    Include Dir:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
checking whether the Boost::Python library is available... no
configure: error: No usable boost::python found

As you can see, python 2.6 is found at configure time, but it chooses
to switch to 2.5 and i dunno why. i tried setting PYTHON_VERSION="2.6"
but i still get the same problem.

Do you have any suggestions about this problem?

Hi Claudio,

I'm trying to build graph-tool (from git) under my Mac OS X 10.4. I
have installed through macports the libboost 1.40 (and boost::python
support for python2.6).

The configure script chooses to build for python 2.5, and therefore it
cannot find boost::python

Different systems call the boost libraries by different names. The
configure script tries to discover this, but it can be unsuccessful. But
you can override it with the --with-boost-python parameter. Try finding
out how the boost::python library is called in your system, and pass it
to this parameter.

Don't worry about the python2.5 thing. This is just the name of the
variable the configure script uses... It is really using 2.6 if it finds
it.

Even if it finds boost::python, you probably will still have problems
later on with the linker, which behaves totally differently in
MacOS... But let's see how far you get. I don't have MacOS so I can't
make it work by myself. But if you are willing, we can try to do it step
by step, based on the information you give me.

Cheers and good luck,
Tiago

how is boost::python called on your system?

Claudio Martella wrote:

how is boost::python called on your system?

On mine it is called simply libboost_python.so, but in sometimes it can
have all sorts of suffixes, link -mt, -py25, etc...

Cheers,
Tiago

OK, here I have
/opt/local/lib/libboost_python-mt.a /opt/local/lib/libboost_python-mt.dylib

I tried --with-boost-library="/opt/local/lib/libboost_python-mt" and
--with-boost-library="-mt" but no success. Do you have any
suggestions?

Claudio Martella wrote:

OK, here I have
/opt/local/lib/libboost_python-mt.a /opt/local/lib/libboost_python-mt.dylib

I tried --with-boost-library="/opt/local/lib/libboost_python-mt" and
--with-boost-library="-mt" but no success. Do you have any
suggestions?

You should try --with-boost-python=boost_python-mt. But you should also
pass --prefix=/opt/local, in case you haven't done so, since it seems
like a non-default directory. In general, these are the following
parameters you have to tweak for a particular environment, in order of
importance, if it is not automatically detected:

     --prefix [general prefix, defaults to /usr/local]
     --with-boost [_include_ directory, if not prefix/include]
     --with-boost-libdir [_library_ directory, if not prefix/lib]
     --with-boost-python [library name, i.e., libboost_python-mt]
     --with-boost-iostreams [the same for boost iostreams]
     --with-boost-regex [the same for boost regex]

Check if the include files and library files are in the expected places
according to the above. If it still fails, take a look at config.log, to
see what it is trying to do, and why it fails. It would also be good if
you could attach this file to your messages if you are still having
problems.

Cheers,
Tiago

OK,

i didn't specify the --prefix but i did specify the library position
through LDFLAGS.

Mac OS X doesn't have many gnu libraries in its default. A project
exists called Macports which is very similar to Gentoo packaging (in
the sense that is sourcebased, handles dependencies, patches online
etc.) and installs everything under /opt/local/.

So, I tried specifing some more options:

./configure LDFLAGS="-L/opt/local/lib" --prefix="/opt/local/"
--with-boost-python="libboost_python-mt"
--with-boost="/opt/local/include/boost/"
--with-boost-libdir="/opt/local/lib/"

error:
checking for the distutils Python package... yes
checking for Python include path...
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
checking for Python library path...
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
-lpython2.6
checking for Python site-packages path...
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
checking python extra libraries... -ldl
checking python extra linking flags... -u _PyMac_Error
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python
checking consistency of all components of python development environment... yes
checking for boostlib >= 1.33.1... 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 <boost/version.hpp>. See http://randspringer.de/boost for
more documentation.

config.log: attached config.log.1

./configure LDFLAGS="-L/opt/local/lib" --prefix="/opt/local/"
--with-boost-python="libboost_python-mt"

error:

checking for the distutils Python package... yes
checking for Python include path...
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
checking for Python library path...
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
-lpython2.6
checking for Python site-packages path...
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
checking python extra libraries... -ldl
checking python extra linking flags... -u _PyMac_Error
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python
checking consistency of all components of python development environment... yes
checking for boostlib >= 1.33.1... yes
checking for python build information...
checking for python2.5... python2.5
checking for main in -lpython2.5... yes
checking python2.5/Python.h usability... yes
checking python2.5/Python.h presence... yes
checking for python2.5/Python.h... yes
  results of the Python check:
    Binary: python2.5
    Library: python2.5
    Include Dir:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
checking whether the Boost::Python library is available... no
configure: error: No usable boost::python found

config.log: attached config.log.2

which is the same as setting BOOST_ROOT="/opt/local/include/boost"

I guess it's missing something from python too!

I attach two files that list the content of the boost and python26
package and where they are put

Hope it helps

boost-content.bin (412 KB)

config.log.1 (71.7 KB)

config.log.2 (72.3 KB)

python26-content.bin (439 KB)

Claudio Martella wrote:

OK,

i didn't specify the --prefix but i did specify the library position
through LDFLAGS.

Mac OS X doesn't have many gnu libraries in its default. A project
exists called Macports which is very similar to Gentoo packaging (in
the sense that is sourcebased, handles dependencies, patches online
etc.) and installs everything under /opt/local/.

So, I tried specifing some more options:

./configure LDFLAGS="-L/opt/local/lib" --prefix="/opt/local/"
--with-boost-python="libboost_python-mt"
--with-boost="/opt/local/include/boost/"
--with-boost-libdir="/opt/local/lib/"

From what I can see, you need only --prefix=/opt/local ... The

--with-boost parameter should be /opt/local/include not
/opt/local/include/boost, but that can be omitted, since it is inferred
from --prefix. The rest seems also redundant, if the correct --prefix is
given. Can you try just with --prefix=/opt/local?

Cheers,
Tiago

./configure --prefix=/opt/local/

checking for the distutils Python package... yes
checking for Python include path...
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
checking for Python library path...
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6
-lpython2.6
checking for Python site-packages path...
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
checking python extra libraries... -ldl
checking python extra linking flags... -u _PyMac_Error
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python
checking consistency of all components of python development environment... no
configure: error:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

config.log (69.4 KB)

by the way --prefix= is for the installation destination, it should
tell anything about the libs positions. Isn't it?

Claudio Martella wrote:

./configure --prefix=/opt/local/

[...]

configure: error:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution. The exact name of this package varies among them.
  ============================================================================

this IS weird.

It is always useful to look in config.log to understand what is going
on, and in this case it is not so complicated. In the log there is the line

configure:16040: gcc -o conftest -g -O2 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 conftest.c -L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6 -lpython2.6 >&5
ld: library not found for -lpython2.6

Which makes sense, since your python library seems to be

/opt/local/lib/libpython2.6.dylib

Therefore you need to include /opt/local/lib/ to your linker path. You
can do this with LDFLAGS="-L/opt/local/lib".

If you think this is annoying, just wait until you get it to start
compiling, and the linker starts really spitting errors... :frowning:

Cheers,
Tiago

Claudio Martella wrote:

by the way --prefix= is for the installation destination, it should
tell anything about the libs positions. Isn't it?

No it is more than that. It is used as the basis for all other
assumptions. It where the "system" should be.

Cheers,
Tiago

I did that since the beginning. It then complains about not finding
boost::python, which is why i wrote you in the first place.

see my first try, so config.log.1

The thing is that i should not install into /opt/local/ as it's for
macports. we should avoid conflicts and macports developers suggest i
should avoid that. so i should not --prefix

Claudio Martella wrote:

I did that since the beginning. It then complains about not finding
boost::python, which is why i wrote you in the first place.

see my first try, so config.log.1

There you did:

./configure LDFLAGS=-L/opt/local/lib --prefix=/opt/local/ --with-boost-python=libboost_python-mt --with-boost=/opt/local/include/boost/ --with-boost-libdir=/opt/local/lib/

Which has a wrong --with-boost parameter... It should have been
"/opt/local/include", or nothing since it is already deduced from
--prefix. You should do simply:

./configure LDFLAGS=-L/opt/local/lib --prefix=/opt/local/

Or with --with-boost-python=boost_python-mt if it can't guess the name
of the library (without the "lib" at the beginning).

The thing is that i should not install into /opt/local/ as it's for
macports. we should avoid conflicts and macports developers suggest i
should avoid that. so i should not --prefix

It is totally fine installing it somewhere else, but then you have to
manually specify where everything is... I would recommend running
configure at least once with --prefix=/opt/local to be sure you have
everything you need, and then later specifying all the "--with..."
parameters and with a different --prefix.

Cheers,
Tiago

./configure LDFLAGS=-L/opt/local/lib --prefix=/opt/local/
--with-boost-python=boost_python-mt

checking python extra libraries... -ldl
checking python extra linking flags... -u _PyMac_Error
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python
checking consistency of all components of python development environment... yes
checking for boostlib >= 1.33.1... yes
checking for python build information...
checking for python2.5... python2.5
checking for main in -lpython2.5... yes
checking python2.5/Python.h usability... yes
checking python2.5/Python.h presence... yes
checking for python2.5/Python.h... yes
  results of the Python check:
    Binary: python2.5
    Library: python2.5
    Include Dir:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
checking whether the Boost::Python library is available... no
configure: error: No usable boost::python found

config.log (72.3 KB)

Claudio Martella wrote:

./configure LDFLAGS=-L/opt/local/lib --prefix=/opt/local/
--with-boost-python=boost_python-mt

Try:

./configure LDFLAGS=-L/opt/local/lib CXXFLAGS="-I/opt/local/include" --prefix=/opt/local/ --with-boost-python=boost_python-mt

It don't object helping you like this, but maybe we should take this off the
list, since it may take forever with back and forth messages like this. Could
you please respond in private from now on?

Cheers,
Tiago