artemp/trac2github — Issue #64: Support for OSX Leopard and Solaris (using Sun Studio compiler)
Author: artemp
Created: 2011-10-09 20:11:22+00:00
State: open
Labels: Core_Library

I wanted to get this out to the Mapnik community for discussion. This patch fixes issues with compiling on OSX Leopard (10.5) (specifically in [browser:src/unicode.cpp unicode.cpp]), and provides very rough support for the Sun Studio `CC` C++ compiler on Solaris. In the process, `SConstruct` was re-worked a bit and a SCons bug was fixed (was specific to Solaris-only).

As far as I know, this is the first attempt to use a C++ compiler other than `g++` (with the exception of the MS Windows references I've seen sprinkled in the code). My C++ is a bit rusty, but this highlights some code with portability issues across compilers.

Some highlights of code that was troublesome for Sun's compiler:

* The following [browser:trunk/boost/property_tree/detail/ptree_implementation.hpp@600#L909 line] in the Boost `property_tree` implementation gave errors about "the declaration needs to be within a statement":
{{{
typename traits_type::template inserter()(m_impl->m_data, value, loc);
}}}

* In [browser:trunk/include/mapnik/utils.hpp utils.hpp], the following lines (L83 and L92):

{{{
static void destroy(volatile T* obj)
...
friend class CreatePolicy;
}}}

The Sun compiler raises errors about the use of the `volatile` keyword and that the `friend` class declaration "must specify a class or function."

* All of the `inline` declarations in [browser:trunk/src/envelope.cpp envelope.cpp].

I also added the `iconv` library to the requisites (even though Artem patched for Darwin in r600) because it was required for both Leopard and Solaris.