I recently upgraded to the MacPython binary off python.org because I
needed the python framework not included in the built-in mac python
(lame) for another project. I guess I could have built from source but
I liked how the binary kept everything clean and it was relatively
straight forward to get going. I was curious enough to then rebuild
mapnik against the new binary, problems problems problems ensued (not
related to mapnik)... I imagine this will bite anybody who upgrades
their core python and tries to rebuild mapnik and also happens to have
the boost libs built from macports.

The scenario goes as follows...

$ sudo python scons/scons.py TIFF_INCLUDES=/usr/local/include
JPEG_LIBS=/opt/local/lib JPEG_INCLUDES=/opt/local/include DEBUG=y
BOOST_LIBS=/usr/local/lib BOOST_INCLUDES=/usr/local/include/boost-1_35

Mapnik will build just fine and not complain but when importing I get
the "Fatal Python error: Interpreter not initialized (version
mismatch?)". Turned out that my new mapnik build (from r738 at the
time of this writing) was still linking to my old boost libraries in
/opt/local/lib. I found this out by doing:

$ otool -L 
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/site-packages/mapnik/_mapnik.so

Why the mac does this I'm not sure but the output clearly shows that
mapnik isn't linked to the correct boost libraries even though I just
specified everything in the scons build and had rebuilt all the boost
libraries in /usr/local/lib.

So to sanitize everything I removed _mapnik.so and my entire mapnik
svn checkout, also removed all the macports boost garbage I had
leftover from my previous installation (this is most likely the
problem). It was only after removing the /opt/local/lib stuff that I
was able to get mapnik to read my boost libs in /usr/local/lib even
though that is what I specified in my scons arguments.

$ sudo rm 
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/site-packages/mapnik/_mapnik.so
$ sudo port uninstall boost

I then followed the boost build instructions at
http://trac.mapnik.org/wiki/MacInstallation. The symbolic links were a
little different on my system, they were as follows... Notice the
libboost_python link at the end (the crux of the fatal error).

$ sudo ln -s libboost_system-mt-1_35.dylib boost_system-mt.dylib
$ sudo ln -s libboost_system-mt-1_35.dylib libboost_system-mt.dylib
$ sudo ln -s libboost_filesystem-mt-1_35.dylib libboost_filesystem-mt.dylib
$ sudo ln -s libboost_regex-mt-1_35.dylib libboost_regex-mt.dylib
$ sudo ln -s libboost_iostreams-mt-1_35.dylib libboost_iostreams-mt.dylib
$ sudo ln -s libboost_program_options-mt-1_35.dylib
libboost_program_options-mt.dylib
$ sudo ln -s libboost_thread-mt-1_35.dylib libboost_thread-mt.dylib
$ sudo ln -s libboost_python-mt-1_35.dylib libboost_python-mt.dylib

>From there I was able to rebuild and run mapnik without any more
hitches. Going to add this to the wiki right now. If you see any
problems with this please let me know.

-Matt
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to