How to build Boost 1.34 by Sun C++

Here is the summary of comments to my previous post and results of my experiments.

First of all to build Boost you need bjam. If you work on Linux take pre-compiled binaries of bjam here. If you target OS is Solaris look at my instruction how to build bjam.

If you need to build Boost for 32-bit architecture just untar Boost archive, go to boost_1_34_1 directories and type bjam toolset=sun stdlib=sun-stlport stage. That is all you need.

If you want to build Boost for 64-bit architecture the life became is a bit more complicated. You have to fix tools/build/v2/tools/sun.jam. Add following lines to this file just before comment line # Declare generators.

flags sun OPTIONS <architecture>/<address-model>32 : -m32 ;
flags sun OPTIONS <architecture>/<address-model>64 : -m64 ;
flags sun OPTIONS <link>shared : -Kpic ;

After that you can type bjam toolset=sun stdlib=sun-stlport address-model=64 stage to build Boost. Unfortunately Python Boost library shows an error during compilation. The error comes from python2.5/pyport.h so maybe the reason of this error my own broken Python configuration.

I do not have a time to fix configuration error in the Boost library so if somebody file a bug or/and a patch to Boost bug track it would be really nice.

And the last point. I recommend to read Boost Getting Started article. It has been rewritten since Boost 1.33.

Comments:

I've just compiled boost 1.34 with:
CC: Sun C++ 5.8 Patch 121017-02 2006/04/19
Below are the changes I had to make to the source files. I haven't tested it yet but at least it compiles OK.

1. boost_1_34_1/boost/graph/detail/read_graphviz_spirit.hpp
diff orig/read_graphviz_spirit.hpp fix/read_graphviz_spirit.hpp
530a531,535
> #if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
> | comment_p(str_p("//"))
> | comment_p(str_p("#"))
> | confix_p(str_p("/\*") ,\*anychar_p, str_p("\*/"))
> #else
536a542
> #endif

2. boost_1_34_1/boost/python/converter/arg_to_python.hpp
diff orig/arg_to_python.hpp fix/arg_to_python.hpp
34a35,36
> #include <boost/detail/workaround.hpp>
>
215c217,221
< : arg_to_python_base(x, registered_pointee<Ptr>::converters)
---
> #if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
> : arg_to_python_base(reinterpret_cast<void\*>(x), registered_pointee<Ptr>::converters)
> #else
> : arg_to_python_base(x, registered_pointee<Ptr>::converters)
> #endif

3. boost_1_34_1/libs/python/src/object/class.cpp
diff orig/class.cpp fix/class.cpp
19a20
> #include <boost/detail/workaround.hpp>
458c459,463
< : api::getattr(scope(), "__module__", str())
---
> #if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
> : api::getattr<boost::python::scope, char[11], boost::python::str>(scope(), "__module__", str())
> #else
> : api::getattr(scope(), "__module__", str())
> #endif

Posted by Pawel Bulkowski on August 27, 2007 at 01:33 PM MSD #

Pawel, just as with build system, the only way to get this fixed is to file issues at svn.boost.org -- preferably one issue per library.

Posted by Vladimir Prus on August 29, 2007 at 09:24 AM MSD #

I'm trying to build 1.34.1 as 64-bit static libs on a Solaris 10/x86 machine. My compiler reports CC: Sun C++ 5.8 Patch 121018-05 2006/08/30. -m64 is not recognized by the Sun Studio compiler. It appears to be an option for g++, though. I tried swapping in -xtarget=opteron -xarch=amd64 in the three additional lines you suggested for sun.jam, but I'm still getting 32-bit objects and libraries.

I've also tried to use toolset=gcc on Solaris, but I'm getting problems because /usr/ccs/bin/ld doesn't gake GNU ld syntax and I can't figure out how to tell bjam that ld is sun-flavor or to use /usr/sfw/bin/gld instead. --linker-type=sun doesn't seem to do it.

Anyone have suggestions for either?

Posted by Scott Ventura on September 05, 2007 at 06:05 PM MSD #

-m32 and -m64 command line options are available since Sun Studio 12 (Sun C++ 5.9). This post contains some hints how to compile 64-bit library using another compiler versions
http://blogs.sun.com/sga/entry/boost_and_64_bit_mode1

But I recommend to upgrade to 5.9 :-)

Posted by Simon Atanasyan on September 05, 2007 at 06:30 PM MSD #

What I do not understand is that there were no errors except for the python problem. I have been trying to make boost, following the instructions above and it fails. There are issues reported in boost itself but there are problems reported with
inconsistencies relating to casts.

I have submitted a full log to the boost mailing list and I hope that some light can be shed on this.

Why does it have to be so difficult for the non gnu and non linux users?

Posted by lydia heck on March 05, 2008 at 02:14 PM MSK #

Post a Comment:
  • HTML Syntax: NOT allowed
About

atanasyan

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today