views:

301

answers:

3

I am currently developing on OpenSolaris 2009-06. The Boost::MPL Documentation seems to suggest that sun compilers are not supported (the document was last updated in 2004 ). Boost's top level documentation seems to suggest that the sun compilers 5.10 onwards are supported -- I guess this is a general level of support or does this include MPL ?. Does anyone have any details on the state of the C++ conformance of the sun 5.10 compilers ?

I could always compile using GCC.

+3  A: 

I have had some success with Boost and Sun's CC compiler on Solaris 10, but it is a pain. The main thing to remember is you need,

 -library=stlport4 -features=tmplife -features=tmplrefstatic

in you CXXFLAGS for everything you compile, all the template only libraries I have tried seem to work fine with this,(skip all the libraries which need compiling, see here for details )

This does mean of course, that you will have to rebuild any libraries you need to link to (you would be very lucky if they already used stlport4).

Sadly, this is about the only (tenuously) valid reason for not using Boost :-(

Sun C++ Frontend tails blog

Chris Huang-Leaver
Compilation wasn't really the problem, especially with 1.41 as they have fixed the build scripts to use stlport4. The problem is with the specific peculiarites of the template metaprogramming constructs.
Hassan Syed
If you have millions of lines of legacy code built with the old stl, which you have to link to, it's a problem! That said, some of the packages do work with the default compiler settings, Boost::Tokenizer for example.
Chris Huang-Leaver
@Chris: How about binaries of libraries compiled with the old stl, when you don't have access to the source? Now that's frustrating!
David Thornley
+2  A: 

I've fought through this problem myself in the past, and it's a pain in the rear.

To be slightly more specific on Chris Huang-Leaver's answer, you really need to use STLPort4 on the Sun compilers. The default STL delivered by Sun is incomplete, per their own documentation (I'll track it down at some point). The other options that Chris mentions are helpful, but they're not really the root of the problem.

The good news is that Sun also delivers STLPort version 4 with their compilers, so all you need is to include the "-library=stlport4" flag in order to switch over to it. Why they deliver two versions (one semi-broken) of the STL, rather than just one correct version, is beyond me.

Russell Newquist
Two words: Legacy code. There's a lot of stuff out there compiled with the old version of the Sun STL, and you can't link libraries compiled with the Sun STL and STLPort. (I've tried.) Some libraries are only available compiled with the old Sun STL (including an Oracle library I really wanted to use about three years ago), and if you're going to use them you're going to use the old broken STL. Yes, I found that extremely frustrating.
David Thornley
Ah, very good point. I should have thought of that, given my own experiences.
Russell Newquist
+1  A: 

I guess since an exact answer has not been provided I must post one myself.

opensolaris(2009.06) and boost-1.4.1 seem to work well. The ./bjam picks the right switches and boost::mpl seems to work well with the sun compiler present. So, as far as I can tell the mpl documentation on compiler support is quite outdated.

Hassan Syed