Ticket #19114 (closed submission: fixed)
New Port: Mapnik
| Reported by: | dbsgeo@… | Owned by: | macports-tickets@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 1.7.0 |
| Keywords: | gis,graphics,boost,python | Cc: | macsforever2000@… |
| Port: | Mapnik |
Description
A few other tickets (#12784,#18071) have posted Portfiles for Mapnik.
Here is an updated port for the new 0.6.0 release, in the hopes that the core MacPorts team can help push it over a few last hurdles.
This document (hosted where I developed the portfile) describes a notable problem with boost:
http://mapnik-utils.googlecode.com/svn/sandbox/ports/README.txt
Attachments
Change History
Changed 4 years ago by dbsgeo@…
- Attachment Portfile.2 added
Updated portfile that fetches from tarred release
comment:4 Changed 4 years ago by macsforever2000@…
I'm not able to get this to run. It builds fine, but I see the following error in ipython2.5
$ ipython2.5
Python 2.5.4 (r254:67916, Apr 11 2009, 14:47:01)
Type "copyright", "credits" or "license" for more information.
IPython 0.9.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import mapnik
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/Users/frank/Downloads/mapnik-0.6.0/scons/<ipython console> in <module>()
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mapnik/__init__.py in <module>()
52 setdlopenflags(RTLD_NOW | RTLD_GLOBAL)
53
---> 54 from _mapnik import *
55 from paths import inputpluginspath, fontscollectionpath
56
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mapnik/_mapnik.so, 10): Library not loaded: libmapnik.dylib
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mapnik/_mapnik.so
Reason: image not found
Changed 4 years ago by macsforever2000@…
- Attachment Portfile.3 added
I'm attaching my version of the portfile with some fixes such as switching to bzip2 so it downloads.
comment:5 Changed 4 years ago by dbsgeo@…
Great, thanks for taking a look at this and for the fixes.
I'm curious about the switch to using:
FRAMEWORK_PYTHON=True
My experience is that will more likely link the python module against the system python, and will create a version mismatch if boost is correctly linked to the macports python (but see #17998).
What does this give on your system?
otool -L /opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mapnik/_mapnik.so
And
otool -L /opt/local/lib/mapnik/libmapnik.dylib
Regarding the error, this is happening because libmapnik.dylib is likely installed in
/opt/local/lib/mapnik/libmapnik.dylib
but not automatically found without:
export DYLD_LIBRARY_PATH=/opt/local/lib/mapnik/
Does setting that allow the library to be found?
comment:6 Changed 4 years ago by dbsgeo@…
Okay, looks like I've got a fix for the library issue. Using export DYLD_LIBRARY_PATH=/opt/local/lib/ is a disaster.
Here is a patch that fixes things by providing the full path to the library location:
See: http://qin.laya.com/tech_coding_help/dylib_linking.html
Index: src/SConscript
===================================================================
--- src/SConscript (revision 1105)
+++ src/SConscript (working copy)
@@ -31,13 +31,15 @@
install_prefix = env['DESTDIR'] + '/' + prefix
+libdir = os.path.normpath(install_prefix + '/' + env['LIBDIR_SCHEMA'])
+
libraries = env['LIBS']
if env['INTERNAL_LIBAGG']:
libraries.insert(0, 'agg')
if env['PLATFORM'] == 'Darwin':
- linkflags = '-Wl,-install_name,libmapnik.dylib'
+ linkflags = '-Wl,-install_name,%s/libmapnik.dylib' % libdir
elif env['PLATFORM'] == 'SunOS' and env['CXX'].startswith('CC'):
linkflags = '-R. -h libmapnik.so'
else: # Linux and others
comment:7 Changed 4 years ago by dbsgeo@…
Also, attaching a new portfile which removes the optional LIB_DIR_NAME usage (which does not affect the libmapnik.dylib but will result in problems with fonts due to a bug now fixed in trunk.
comment:8 Changed 4 years ago by dbsgeo@…
Okay, I've given up with python25 because the boost python port can link against it.
But the python26 install with boost +python26 works.
So, I'm attaching a new Portfile for python 26 from here:
http://mapnik-utils.googlecode.com/svn/sandbox/ports/graphics/py26-mapnik/Portfile
with a slightly improved 'src/SConscript' patch as well.
It will need python26 rebuilt after:
Changed 4 years ago by dbsgeo@…
- Attachment Portfile.5 added
Python 2.6 Port (abandoning python25 version)
Changed 4 years ago by dbsgeo@…
- Attachment patch-src-Sconscript.diff added
install_name patch to allow libmapnik.dylib to be found by python bindings without setting DYLD_LIBRARY_PATH
comment:9 Changed 4 years ago by dbsgeo@…
This Portfile is now working great for the first time for me with Portfile.5, the corresponding patch, and these steps:
sudo port install python26 python_select sudo python_select python26 sudo port install jam sudo port install boost +icu +python26 sudo port install py26-mapnik
comment:10 Changed 4 years ago by dbsgeo@…
I should mention that one small problem still exists.
The SCons build tool is failing to properly sense build targets so all files are being compiled twice. Adding the argument --debug=explain show that SCons is being dumb here so I need to look into why this as happening as it makes the build take twice as long.
An alternative would be to build and install in one fell swoop but I'm not sure about how to do that in the Portfile syntax yet.
comment:11 Changed 4 years ago by dbsgeo@…
Okay, now using configure solves the above problem of double compilation. Portfile again updated, but I'm making small tweaks to the variant options now so until I'm finished the current Portfile can be found at:
http://mapnik-utils.googlecode.com/svn/sandbox/ports/graphics/py26-mapnik/Portfile
Changes made to solve the above problem were: http://code.google.com/p/mapnik-utils/source/detail?r=676#
comment:13 Changed 4 years ago by anonymous
- Milestone Port Submissions deleted
Milestone Port Submissions deleted
comment:14 Changed 4 years ago by dbsgeo@…
Okay, I've found no more major changes needed since my previous comment about fixing the duplicate configure.
As far as I'm concerned this is ready for submission.
I will attach the Portfile again which should be used with the previously attached patch.
Changed 4 years ago by dbsgeo@…
- Attachment Portfile.6 added
Mapnik Portfile working with boost 1.38 and python26
comment:15 Changed 4 years ago by raimue@…
- Status changed from new to closed
- Resolution set to fixed
Committed in r50498.


Portfile against svn tag of Mapnik 0.6.0 (for development - ultimately we can build against tarred release)