Re: [vserver] www.cplusplussucks.com

About this list Date view Thread view Subject view Author view Attachment view

From: Sam Vilain (sam_at_vilain.net)
Date: Fri Apr 26 2002 - 11:18:57 EDT


Jacques Gelinas <jack_at_solucorp.qc.ca> wrote:

> Which gcc distribution is this. There are problems in the STL headers on
> some GCC version. I just compiled it on a pretty vanilla rh6.2. The STL
> headers are part of the package egcs-c++-1.1.2-30

Mmm, I have that version (1.1.2-30). I've checked the packages (egcs,
egcs-c++) are sane with rpm -V.

> To compile the utility, I am including <linux/capability.h> and this is
> kind of bad. The kernel headers are not meant to be included. Normally,
> glibc include files are providing the necessary services to shield
> applications from the kernel headers. But glibc does not support any
> interface to the capability system.
> To fix this one, I suggest you install new kernel headers on the
> compilation machine, potentially taken from a 2.4.18 kernel.

Sure. I have already ensured that /usr/src/linux (and hence,
/usr/include/linux) points to the correct place, in Red Hat tradition.
Looking at the preprocessed output from gcc, it seems to be including the
correct capability.h, from the kernel source tree.

Looking a bit deeper, this is the section of the template library it is
complaining about:

> class __default_alloc_template {
>
> private:
> // Really we should use static const int x = N
> // instead of enum { x = N }, but few compilers accept the former.
> # ifndef __SUNPRO_CC
> enum {__ALIGN = 8};
> enum {__MAX_BYTES = 128};
> enum {__NFREELISTS = __MAX_BYTES/__ALIGN};
> # endif
> static size_t ROUND_UP(size_t bytes) {
> return (((bytes) + __ALIGN-1) & ~(__ALIGN - 1));
> }

Which is being preprocessed to this:

> class __default_alloc_template {
>
> private:
>
>
>
> enum {.align 4,0x90 = 8};
> enum {__MAX_BYTES = 128};
> enum {__NFREELISTS = __MAX_BYTES/ .align 4,0x90 };
>
> static size_t ROUND_UP(size_t bytes) {
> return (((bytes) + .align 4,0x90 -1) & ~(.align 4,0x90 - 1));
> }

Hence this error:

> > /usr/include/g++-2/stl_alloc.h:320: parse error before `.'
> > /usr/include/g++-2/stl_alloc.h:320: missing ';' before right brace
> > /usr/include/g++-2/stl_alloc.h:322: parse error before `.'

But why on earth would it have __SUNPRO_CC defined in the first place?
This baffles me more than RedHat's popularity.

btw

perl -e '`cat /proc/self/status`=~m/__NR_new_s_context: (\d+)/; syscall($1, 10); exec @ARGV'

works.

> I would say this is a bug in the STL headers. Which egcs package are you
> using ?

Name : egcs Relocations: (not relocateable)
Version : 1.1.2 Vendor: Red Hat, Inc.
Release : 30 Build Date: Thu 17 Feb 2000
07:17:14 PM GMT Install date: Wed 26 Jul 2000 06:47:29 PM GMT Build
Host: porky.devel.redhat.com Group : Development/Languages
Source RPM: egcs-1.1.2-30.src.rpm Size : 3447148
      License: GPL Packager : Red Hat, Inc.
<http://bugzilla.redhat.com/bugzilla> URL : http://gcc.gnu.org/
Summary : The GNU Compiler Collection.
Description :
The egcs package contains the GNU Compiler Collection: cc, gcc and
egcs. You'll need this package in order to compile C/C++ code.

--
   Sam Vilain, sam_at_vilain.net     WWW: http://sam.vilain.net/
    7D74 2A09 B2D3 C30F F78E      GPG: http://sam.vilain.net/sam.asc
    278A A425 30A9 05B5 2F13

Tell a man that there are 300 billion stars in the universe, and he'll believe you.... Tell him that a bench has wet paint upon it and he'll have to touch it to be sure.


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Mon Aug 19 2002 - 12:01:01 EDT