[GCC-XML] running with newer gcc compilers (4.2)

Brad King brad.king at kitware.com
Tue Sep 18 16:39:48 EDT 2007


Florian Ludwig wrote:
> Hi there,
> 
> i'm trying to dig into this but i cant even parse a simple "Hello World"
> program. The error looks like this:
> 
> $ gccxml main.cpp -fxml=test.xml
> In file included from /usr/include/c++/4.2/iostream:44,
>                  from main.cpp:1:
> /usr/include/c++/4.2/x86_64-linux-gnu/bits/c++config.h:149: error:
> syntax error 
>    before `__attribute__'
> In file included from /usr/share/gccxml-0.7/GCC/4.1/bits/c++locale.h:4,
>                  from /usr/include/c++/4.2/iosfwd:45,
>                  from /usr/include/c++/4.2/ios:43,
>                  from /usr/include/c++/4.2/ostream:45,
>                  from /usr/include/c++/4.2/iostream:45,
>                  from main.cpp:1:
> [.....]
> 
> 
> I guess its because of the "new" version of gcc? But I dont really have
> a glue. 
> 
> $ gccxml --version
> GCC-XML version 0.7.0
> 
> $ g++ --version
> g++ (GCC) 4.2.1 (Debian 4.2.1-5)
> 
> Both installed from the debian repositories (sid)

GCC-XML internally uses a gcc 3.3 parser with some patching to do the
xml dump.  The way we get this parser to look through the system headers
of other compilers is to copy/patch those headers that it cannot read.
This has worked for every GCC compiler up through 4.1 because only a few
headers need fixing.  Unfortunately the system headers that come with
4.2 *all* use a syntax that is not supported by the 3.3 parser.

I'm currently working on upgrading the internal parser to be the gcc 4.2
parser.  Upgrading to a 4.x parser internally has been a long-requested
feature anyway.  However I do not know when I will be able to finish
this upgrade.  It is a *major* update.

The work-around for you is

$ sudo apt-get install g++-4.1
$ gccxml main.cpp -fxml=test.xml --gccxml-compiler g++-4.1

-Brad



More information about the gccxml mailing list