Boost logo

Boost :

Subject: [boost] First results using Comeau C/C++ compiler
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2009-11-24 19:08:43


Hi,

After quite some time of trying to build Boost, especially Boost.Test,
using Comeau C/C++ frontend with GCC 4.x on Linux, I've started to get
some promising results.

During this investigation I was juggling number of fixes
and patches [1] and eventually I found quite surprising solution.
Yesterday, while reading signal.h and other headers to find out
how to get signals features compiling for Boost.Test library,
I came across an interesting macro which seems to be a passkey
to the world of GNU C Library for Comeau toolset :-)

It is _GNU_SOURCE macro [2]:

   "If you define this macro, everything is included: ISO C89, ISO C99,
    POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions."

Defining this macro seems to solve all issues I reported [1] so far.
BTW, I've sent request to Comeau team for their opinion about usage of
this macro with Comeau C/C++ frontend. Hopefully, it will be assumed
safe to use, then we've got solution for all/most of the problems.

Second due to the fact Comeau does not support linking as shared,
I had to explicitly request to link Boost.Test binaries statically.

I attach patch for Boost.Test Jamfile.v2 files adding the macro and
configuring static link for como toolset.
Let it be an example showing what kind of changes/options are needed by
como toolset to build Boost.Test binaries.
I haven't tried, but I suppose it's safe to assume that the same
changes are needed to build other libraries like Asio, Program Options,
and others. I'm going to find it out.

To summary, there are two required changes in build configuration to
enable como toolset, so far.
So, what is the best approach to incorporate those two settings to other
libraries (only those when it's needed):
* Should I hack all Jamfiles where those changes are needed?
* Or, it would make sense to set these options for como toolset,
  by default?
* Where <link>static should go? To Jamfiles or nowhere and static
  linking should be explicitly enabled as bjam argument?
  I also tested: como --v2 link=satic

Gennadiy, I'm sorry for making quite a mess in Trac by reporting number
of tickets and submitting number of patches which eventually turned out
to be unnecessary. It took me number of iterations to sort it out
and I was subsequently recording my discoveries.

[1]
- int64_t/uint64_t
https://svn.boost.org/trac/boost/ticket/3548
- snprintf, vsnprintf
https://svn.boost.org/trac/boost/ticket/3558
- POSIX features (e.g. signals.h)
https://svn.boost.org/trac/boost/ticket/3662

[2] _GNU_SOURCE
http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk