Compiling latest Mapnik and OSM plugin on Mac OS X 10.5 - experiences

View: New views
4 Messages — Rating Filter:   Alert me  

Compiling latest Mapnik and OSM plugin on Mac OS X 10.5 - experiences

by Nick Whitelegg-4 :: Rate this Message:

| View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello everyone,

Got the latest mapnik (checked out Wednesday night) compiled on Mac OS X 10.5 with boost 1.37 (macports), but did encounter one or two things not on the wiki page so thought I'd share them.

Firstly, couldn't get mapnik 0.5.1 to build, the SConscript couldn't find the boost shared libraries, even though I gave the path and the -mt matched. However, the SVN version worked fine.

Secondly the "+python2.5" specification when installing Boost actually did pull in Python, and in turn, ncurses, from MacPorts - even though I already have Python 2.5 and ncurses installed (in /usr). It also pulled in gmake 3.81 which I also have already, though it only seemed to need this for installing python and I could remove it afterwards.

Thirdly to compile the rundemo.cpp I needed to add the option -lboost_thread-mt to link the boost-thread library in. Didn't have to do it for any of the other boost libraries though.

Finally, to compile the OSM plugin I needed to link against all the ICU libraries, not sure if this is a Mac specific thing (last time I compiled it was on SuSE 10.3) or a Mapnik update - to compile the OSM plugin I needed to modify the makefile to look like:

CXXFLAGS = `xml2-config --cflags` `freetype-config --cflags` -I/usr/local/include/mapnik -I/opt/local/include  -fPIC -g
MAPNIK_OSM_OBJ = osmparser.o osm.o osm_datasource.o osm_featureset.o
osm.input: $(MAPNIK_OSM_OBJ)
    g++ -dynamiclib -o osm.input $(MAPNIK_OSM_OBJ) `xml2-config --libs` -lmapnik -L/usr/local/lib -L/opt/local/lib -licuuc -liculx -licule -licui18n -licuio -licudata

Nick







_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Compiling latest Mapnik and OSM plugin on Mac OS X 10.5 - experiences

by Dane Springmeyer :: Rate this Message:

| View Threaded | Show Only this Message

Hey Nick,

Thanks to the update!

Comments inline....

On Dec 14, 2008, at 3:42 AM, Nick Whitelegg wrote:

Hello everyone,

Got the latest mapnik (checked out Wednesday night) compiled on Mac OS X 10.5 with boost 1.37 (macports), but did encounter one or two things not on the wiki page so thought I'd share them.

Firstly, couldn't get mapnik 0.5.1 to build, the SConscript couldn't find the boost shared libraries, even though I gave the path and the -mt matched. However, the SVN version worked fine.


Yes, that's my experience on 10.5 as well. I think this reinforces the need for another release to get the recent fixes to SConscript out in the wild.


Secondly the "+python2.5" specification when installing Boost actually did pull in Python, and in turn, ncurses, from MacPorts - even though I already have Python 2.5 and ncurses installed (in /usr). It also pulled in gmake 3.81 which I also have already, though it only seemed to need this for installing python and I could remove it afterwards.


Interesting. The whole approach of macports pulling in its own copies is standard practice but seems dangerous with mapnik once macports requires another python copy. The last time I built boost from macports (1.35) with the +python2.5 was able to link against the system python, so it seems like they've updated the portfile with the new versions.

Cairo and pycairo suffers from the same problem with macports. I worry about setting up new users for the dreaded python version mismatch error when various mapnik library dependencies are linked against both system python and macports python, but I'm not sure about the best solution/recommendation.




Thirdly to compile the rundemo.cpp I needed to add the option -lboost_thread-mt to link the boost-thread library in. Didn't have to do it for any of the other boost libraries though.


Interesting. What were the compile commands needed to built it?



Finally, to compile the OSM plugin I needed to link against all the ICU libraries, not sure if this is a Mac specific thing (last time I compiled it was on SuSE 10.3) or a Mapnik update - to compile the OSM plugin I needed to modify the makefile to look like:

CXXFLAGS = `xml2-config --cflags` `freetype-config --cflags` -I/usr/local/include/mapnik -I/opt/local/include  -fPIC -g
MAPNIK_OSM_OBJ = osmparser.o osm.o osm_datasource.o osm_featureset.o
osm.input: $(MAPNIK_OSM_OBJ)
    g++ -dynamiclib -o osm.input $(MAPNIK_OSM_OBJ) `xml2-config --libs` -lmapnik -L/usr/local/lib -L/opt/local/lib -licuuc -liculx -licule -licui18n -licuio -licudata



Awesome. I've yet to try the OSM plugin, but it looks interesting.  Perhaps we should build the optional compilation in the Sconscript?

Cheers,

Dane




Nick






_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users


_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Compiling latest Mapnik and OSM plugin on Mac OS X 10.5 - experiences

by Nick Whitelegg-4 :: Rate this Message:

| View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello Dane,

>Interesting. What were the compile commands needed to built it?

I used the following:

 g++ -I/usr/local/include/mapnik -I/opt/local/include -I/usr/X11/include -I/usr/X11/include/freetype2 -I../../agg/include -L/usr/local/lib -L/opt/local/lib -lmapnik rundemo.cpp -o rundemo -lboost_thread-mt




>Awesome. I've yet to try the OSM plugin, but it looks interesting.  Perhaps we should build the optional compilation in the Sconscript?

Sounds a good plan. I'm planning to work on an application which allows people to generate Mapnik tiles from .osm files on their home computer, then upload it to a server, lowering the barrier to setting up a Mapnik OSM slippy map server yourself.

Nick




_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Compiling latest Mapnik and OSM plugin on Mac OS X 10.5 - experiences

by Dane Springmeyer :: Rate this Message:

| View Threaded | Show Only this Message

Nick,


>Awesome. I've yet to try the OSM plugin, but it looks interesting.  Perhaps we should build the optional compilation in the Sconscript?

Sounds a good plan. I'm planning to work on an application which allows people to generate Mapnik tiles from .osm files on their home computer, then upload it to a server, lowering the barrier to setting up a Mapnik OSM slippy map server yourself.

Nick



This sounds excellent. Note in http://trac.mapnik.org/changeset/889 I've added support for building the osm plugin via SCons. Please review and test if you can.

To request building the osm plugin do:

$ python scons/scons.py INPUT_PLUGINS=osm # or all

I then used nik2img.py (easy_install nik2img) to render a few maps from your test.xml and it worked great!

$ cd plugins/input/osm/
$ nik2img.py -m test2.xml -o test.png --zoomto -1.4,50.9,16

That produces the attached image.

Good stuff!

Dane




_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users