2

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.

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Hassan Syed
  • 20,075
  • 11
  • 87
  • 171
  • 6
    Boost::MPL seems to have an extensive set of unit tests, you can try to run them under your compiler. This should give you the most recent status of support, regardless of any documentation. – liori Nov 29 '09 at 22:09
  • What liori said, but if you are looking to make sure that your environment is working as expected you would have nothing to compare it to. You should find some documentation about what is to be expected, then also run the unit tests and see if they are what the document projected. – Brian T Hannan Nov 29 '09 at 22:26
  • 1
    Thanks guys, I have done some prototyping with the MPL libraries and they seem to work fine (with the few constructs I tried). However the code ends up looking nasty. So I think i'll move into generative programming probably using Lua and targeting the C++ with STL and possibly the simple BOOST libraries. – Hassan Syed Nov 30 '09 at 16:08

3 Answers3

3

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

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Chris Huang-Leaver
  • 6,059
  • 6
  • 41
  • 67
  • 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 Nov 30 '09 at 15:47
  • 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 Dec 01 '09 at 11:34
  • 1
    @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 Dec 09 '09 at 19:21
2

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
  • 2,656
  • 2
  • 16
  • 18
  • 1
    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 Dec 09 '09 at 19:21
  • Ah, very good point. I should have thought of that, given my own experiences. – Russell Newquist Dec 09 '09 at 23:50
1

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
  • 20,075
  • 11
  • 87
  • 171