Compiling PythonMagick with MacPorts python, imagemagick, boost?

Leonard Lin lhl at randomfoo.net
Sun Dec 5 19:27:00 PST 2010


Hi,

I'm having some problems trying to compile the PythonMagick
(http://www.imagemagick.org/download/python/) ImageMagick/Magick++
bindings and was hoping to get some help.

It seems to have problems finding the boost python .hpp files even
though they are in /opt/local/include (i.e.
/opt/local/include/boost/python/module.hpp)

Is there something I need to add to the configure options?  I've tried a
fair combination of options already. Is there something in the Makefiles
I need to edit directly?  Has anyone had success with getting this setup
before?

I am running on Snow Leopard 10.6.5 w/ MacPorts 1.9.2 (everything up to
date)

I have the following ports installed:
- python27 @2.7_1
- ImageMagick @6.6.6-0_0+q16
- boost @1.45.0_0+python27

I've used python_select, so that python27 is active and the default
python.  A double-check shows that boost is pointing to the right python:

otool -L /opt/local/lib/libboost_python.dylib
/opt/local/lib/libboost_python.dylib:
	/opt/local/lib/libboost_python.dylib (compatibility version 0.0.0,
current version 0.0.0)
	/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.9.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.2.1)

otool -L /opt/local/lib/libboost_python-mt.dylib
/opt/local/lib/libboost_python-mt.dylib:
	/opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0,
current version 0.0.0)
	/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.9.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.2.1)

When I try to configure PythonMagick, it seems to find the right Python
(2.7) and finds boost, but can't seem to find Boost::Python?

configure:14273: checking for python
configure:14291: found /opt/local/bin/python
configure:14303: result: /opt/local/bin/python
configure:14321: checking for python version
configure:14328: result: 2.7

...

configure:14627: checking for boostlib >= 1.20.0
configure:14681: g++ -c -g -O2  -I/opt/local/include conftest.cpp >&5
configure:14681: $? = 0
configure:14683: result: yes

...

configure:14932: result:   results of the Python check:
configure:14934: result:     Binary:      python
configure:14936: result:     Library:     python
configure:14938: result:     Include Dir: no
configure:14950: checking whether the Boost::Python library is available
configure:14980: g++ -c -g -O2  conftest.cpp >&5
conftest.cpp:23:36: error: boost/python/module.hpp: No such file or
directory
conftest.cpp:24: error: 'boost' has not been declared
conftest.cpp:24: error: 'python' is not a namespace-name
conftest.cpp:24: error: expected namespace-name before ';' token
conftest.cpp:25: error: expected constructor, destructor, or type
conversion before '(' token
configure:14980: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "PythonMagick"
| #define PACKAGE_TARNAME "PythonMagick"
| #define PACKAGE_VERSION "0.9.2"
| #define PACKAGE_STRING "PythonMagick 0.9.2"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_BOOST /**/
| /* end confdefs.h.  */
|
|  #include <boost/python/module.hpp>
|  using namespace boost::python;
|  BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }
| int
| main ()
| {
| return 0;
|   ;
|   return 0;
| }
configure:14995: result: no

When compiling, it fails like so:

Making all in pythonmagick_src
/bin/sh ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.
-I../config    -I -I/opt/local/include -fopenmp
-I/opt/local/include/ImageMagick   -g -O2 -DBOOST_PYTHON_DYNAMIC_LIB -MT
libpymagick_la-_DrawableFillRule.lo -MD -MP -MF
.deps/libpymagick_la-_DrawableFillRule.Tpo -c -o
libpymagick_la-_DrawableFillRule.lo `test -f '_DrawableFillRule.cpp' ||
echo './'`_DrawableFillRule.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../config -I
-I/opt/local/include -fopenmp -I/opt/local/include/ImageMagick -g -O2
-DBOOST_PYTHON_DYNAMIC_LIB -MT libpymagick_la-_DrawableFillRule.lo -MD
-MP -MF .deps/libpymagick_la-_DrawableFillRule.Tpo -c
_DrawableFillRule.cpp  -fno-common -DPIC -o
.libs/libpymagick_la-_DrawableFillRule.o
_DrawableFillRule.cpp:3:28: error: boost/python.hpp: No such file or
directory
_DrawableFillRule.cpp:4:29: error: boost/cstdint.hpp: No such file or
directory
_DrawableFillRule.cpp:13: error: 'boost' has not been declared
_DrawableFillRule.cpp:13: error: 'python' is not a namespace-name
_DrawableFillRule.cpp:13: error: expected namespace-name before ';' token
_DrawableFillRule.cpp:19: error: expected `)' before '*' token
_DrawableFillRule.cpp:23: error: ISO C++ forbids declaration of
'PyObject' with no type
_DrawableFillRule.cpp:23: error: expected ';' before '*' token
_DrawableFillRule.cpp: In function 'void
Export_pyste_src_DrawableFillRule()':
_DrawableFillRule.cpp:33: error: 'class_' was not declared in this scope
_DrawableFillRule.cpp:33: error: expected primary-expression before ','
token
_DrawableFillRule.cpp:33: error: 'boost' has not been declared
_DrawableFillRule.cpp:33: error: expected primary-expression before '>'
token
_DrawableFillRule.cpp:33: error: 'init' was not declared in this scope
_DrawableFillRule.cpp:33: error: expected primary-expression before 'const'
_DrawableFillRule.cpp:33: error: expected `)' before 'const'
make[1]: *** [libpymagick_la-_DrawableFillRule.lo] Error 1
make: *** [all-recursive] Error 1



More information about the macports-users mailing list