Home

Sponsors

Running

Download

Install

FAQ

Bug Tracker

News

Links

Copyright

**NOTE**: Installing GCC-XML has been significantly simplified by combining a patched GCC with the GCC-XML front-end in a single source tree. This page is provided for historical purposes. Please see the current installation instructions if you are new to GCC-XML.

Installing GCC-XML involves two components:

  1. A front-end executable that makes GCC-XML easy to run (gccxml).
  2. The GCC exectutable with the XML-dump extension (gccxml_cc1plus).
Each component may need to be built and installed separately. On Windows, there is a pre-compiled package with an installation program that installs both components. Refer to the Download page to get it.

Before you install GCC-XML, you should check that your compiler is supported. In this case, compiler support refers to what compilers can be simulated, not what compilers can be used to build GCC-XML. See the page on Running GCC-XML for a list of supported compilers.

The gccxml_cc1plus Executable

The first part to build and install is the patched GCC executable, which will become gccxml_cc1plus.

Windows

In order to build gccxml_cc1plus on Windows, you will need the Cygwin tools with its version of GCC. Once you have obtained these, follow the UNIX instructions to build gccxml_cc1plus.

If installing cygwin is not an option, you may wish to just get the pre-built binary copy of the executable available on the Download page. The binary copy of gccxml_cc1plus does not include the GCC-XML front-end (but the installer download includes both). You may still build the front-end yourself without Cygwin.

UNIX & Cygwin

There are two ways to build the gccxml_cc1plus executable. Choose one of these:
  • Download the pre-patched source to GCC and build it. See the Download page to get it. This is the recommended approach for UNIX users, and is detailed below.
  • Download the entire GCC 3.0.4 compiler source from GCC's web site, apply the GCC-XML patch, and install the compiler with the extension built in. See the page on Patching GCC for instructions.
Follow the instructions below to build the part of GCC you need to get the gccxml_cc1plus executable. It is assumed that you have extracted the pre-patched GCC source in your home directory, so the source appears in ~/gccxml-0.4.2-cc1plus-304. You will build the program in a parallel directory called ~/gccxml-0.4.2-cc1plus-304-build.
  1. Configure and build GCC (but don't install it). Don't bother with a bootstrap, just run make after the configuration step. Example:
    $ cd ~
    $ mkdir gccxml-0.4.2-cc1plus-304-build
    $ cd gccxml-0.4.2-cc1plus-304-build
    $ ../gccxml-0.4.2-cc1plus-304/configure \
    --enable-languages=c++ \
    --without-libstdcxx
    $ make
    This example builds all of GCC's C++ compiler and its standard library, but all you really need is one exectuable. If you want to try to build the minimal portion of GCC needed, try these instructions. If you want more detailed instructions about building GCC, go here.
  2. When the build finishes, find the file ~/gccxml-0.4.2-cc1plus-304-build/gcc/cc1plus. This program is GCC's C++ compiler which is run by the gcc driver program for C++ sources. It does not automatically add any preprocessor macros (like __GNUC__), so we can use it to exactly control how our source is parsed. This is the only part of the compiler you need, and is the gccxml_cc1plus executable. Copy this program to the directory PREFIX/bin, and rename it to gccxml_cc1plus (keep the .exe extension under Cygwin). Here, "PREFIX" refers to your GCC-XML front-end installation prefix, such as /usr/local (see below).

The gccxml Front-End

The front-end program wraps the gccxml_cc1plus exectuable and makes it easy to run by automatically determining the set of flags needed to make GCC-XML parse your code just as your compiler would. See the page on Running GCC-XML for details.

In order to build and install the front-end, you will need a copy of the GCC-XML source. See the Download page to get it. The standard way to build the GCC-XML front-end is to use CMake (version 1.2 or higher). CMake will generate an appropriate build system for your platform and compiler. Binaries are available on the CMake web page for many platforms.

Windows

Run the CMakeSetup GUI to generate the build system for your compiler. Load the resulting project file and build it. Place the gccxml_cc1plus executable (built above) at the top of your build tree. You should be able to run the gccxml executable directly from the build directory. Currently there is no support for installing GCC-XML from a Windows build. If you want to install it, use the installer program available on the Download page.

UNIX & Cygwin

These instructions assume that the front-end will be built out-of-source (recommended), but an in-source build should also work. The commands below assume that you have extracted the source code into your home directory as ~/gccxml-0.4.2
$ mkdir gccxml-0.4.2-build
$ cd gccxml-0.4.2-build
$ cmake ../gccxml-0.4.2
$ make
$ make install
You can change the install prefix by adding -DCMAKE_INSTALL_PREFIX:PATH=/installation/path to the CMake command (default is /usr/local). If you are familiar with CMake, you should probably use the ccmake curses dialog instead.

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 installed in PREFIX/share/GCC_XML.

The "make install" step is optional. If you place the gccxml_cc1plus executable in your build tree instead, then you will be able to run gccxml directly from there.