1. Jason R. Coombs
  2. gcc-xml


gcc-xml / GCC_XML /

Filename Size Date modified Message
3.0 KB
1.7 KB
4.1 KB
5.4 KB
5.2 KB
10.1 KB
2.0 KB
5.5 KB
1.6 KB
48.4 KB
GCC-XML - This program dumps an XML description of C++ source code
using an extension on the GCC C++ compiler.

This README is intended as supplement to the documentation on the
GCC-XML homepage at http://www.gccxml.org.


There are two parts to GCC-XML, each of which must be built separately:
  1.)  The GCC exectutable with the GCC-XML extension (gccxml_cc1plus).
  2.)  A front-end executable that makes GCC-XML easy to run.

This README is intended to document the front-end executable.  See the
web page for instructions to build the patched GCC executable.

The standard way to build the GCC-XML front-end is to use CMake (see
links at bottom to get it).  CMake will generate an appropriate build
system for your platform and compiler.  There are separate
instructions for UNIX and Windows users.

UNIX & Cygwin:
These instructions assume that the front-end will be built
out-of-source (recommended), but an in-source build should also work.

$ mkdir GCC_XML-build
$ cd GCC_XML-build
$ cmake ../GCC_XML -DCMAKE_INSTALL_PREFIX:PATH=/installation/path
$ make
$ make install

  (The "-D..." option can be left off if you want
   to use "/usr/local" as the installation prefix.)

This will install an executable called "gccxml" in PREFIX/bin.  You
should place the "gccxml_cc1plus" executable next to it in this
directory.  Support library files will also be placed in

Run the CMakeSetup GUI to generate the build system for your compiler.
Load the resulting project file and build it.  You should be able to
run the executable directly from the build directory.


Once GCC-XML has been properly configured, it can be run on a command line
like this:

  gccxml input.cxx -fxml=output.xml

The front-end executable will find the proper flags and run the real
GCC-XML executable (see below).  Use "gccxml --help" to get a full
list of available options.

GCC-XML works with an entire translation unit just as your compiler
sees it.  Therefore, it must be properly configured to simulate your
compiler's preprocessor and use its library's header files.  The
front-end executable does most of this work automatically, but there
are several customization options:

GCCXML_EXECUTABLE = The path to the real GCC-XML executable (gccxml_cc1plus).
                    By default, the executable is found next to the
                    gccxml front-end executable.
GCCXML_COMPILER   = The compiler that the real GCC-XML executable is to
                    simulate.  This setting is used only for automatic
                    detection of the GCCXML_FLAGS setting.
GCCXML_FLAGS      = The set of flags to pass to the real GCC-XML executable
                    to make it simulate a particular compiler.  This setting
                    is automatically detected, but can be configured for
                    very customized runs by experts.
GCCXML_USER_FLAGS = Flags to add when the real GCC-XML executable is run.
                    These can be set while still allowing the front-end
                    executable to automatically detect the main GCCXML_FLAGS
GCCXML_ROOT       = The path to the support library containing patched
                    headers for supported compilers.
GCCXML_CONFIG     = The path to a configuration file from which to read
                    settings for other values.

Most users should not have to adjust the defaults for these settings.
There is a GCCXML_CONFIG file provided by default in the support
library directory after installation.  It configures GCC-XML to
simulate the compiler that was used to build it.

For those who wish to change them, there are several ways to do it.
They are listed here in order of precedence.

1.) Command line options:
     Use "--gccxml-executable xxx" to set GCCXML_EXECUTABLE.
     Use "--gccxml-compiler xxx" to set GCCXML_COMPILER.
     Use "--gccxml-config xxx" to set GCCXML_CONFIG.
     Use "--gccxml-root xxx" to set GCCXML_ROOT.
    If GCCXML_CONFIG is set on the command line, the settings read from
    the config file take precedence equal to command line settings.
2.) Environment variables.  Any of the settings will be read from the
    environment.  If GCCXML_CONFIG is set, settings read from the config
    file will take precedence equal to environment variable settings.
3.) If GCCXML_CONFIG is not set by now, an attempt is made to find
    a configuration file automatically.  First, if the file
    $HOME/.gccxml/config exists, it will be used.  Second, if the
    front-end is being run from its build directory, a config file
    from that directory will be used.  Finally, if a config file is found
    in the installation's support library directory, it will be used.
4.) Guesses will be made based on other settings that have found.  This is
    the usual way to get the GCCXML_FLAGS setting.

To see the configuration settings that will be used when running
GCC-XML, use the "--print" command-line option.  It will list the
settings found and then exit.


GCC-XML homepage:


CMake homepage:


GCC-XML mailing list address:


GCC-XML mailing list page: