Sun C++ Compilers and Boost

1.4k views Asked by At

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

There are 3 answers

0
Hassan Syed On BEST ANSWER

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.

2
Russell Newquist On

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.

3
Chris Huang-Leaver On

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