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.

Patching the source to GCC 3.0.4 is the choice for you if you want to make the extension part of your installation of GCC. The extension is "read-only" in that it will not modify GCC's internal representation of a program in any way. If you want to use GCC-XML only as a separate tool, you should use the normal Installation instructions.

  1. Begin by obtaining a copy of the source to GCC 3.0.4. Go here for instructions to get it via CVS. Use "-r gcc_3_0_4_release" when doing a CVS checkout to get the 3.0.4 release. For the instructions below, I assume that GCC is in the directory "~/gcc".
  2. Create a location separate from the GCC tree for the extension. Check out the extension source from the GCC-XML repository. See the Download page for instructions. For the instructions below, I assume that the GCC-XML is in the directory "~/GCC_XML".
  3. Copy the file xml.c from the GCC_XML source to the directory ~/gcc/gcc/cp:
    $ cp ~/GCC_XML/xml.c ~/gcc/gcc/cp/xml.c
    A symbolic link would also suffice.
  4. Patch the directory ~/gcc/gcc/cp with ~/GCC_XML/gcc_cp_304.patch:
    $ cd ~/gcc/gcc/cp
    $ patch <~/GCC_XML/gcc_cp_304.patch
    Instead of patching the directory, you can also try to edit the GCC sources yourself to make the (few) changes. If you want to try this, go here for instructions.
You should now be able to bootstrap and install GCC. Go here for instructions. The installed compiler will have the -fxml=... flag available. However, you should be careful using it through the compiler-driver programs like gcc or g++. These programs add extra preprocessor macro definitions that may affect the parsing of the code. Instead, you should use the tool through the cc1plus executable so that you can exactly control the way your code is pre-processed before being dumped in XML. This executable is located in PREFIX/lib/gcc-lib/PLATFORM/3.0.4 (where PREFIX is your installation prefix, and PLATFORM is something like i686-pc-linux-gnu).

The next step is to build the GCC-XML front-end program. See the normal Installation instructions to do this. Whenever they refer to placing the gccxml_cc1plus executable in a certain location, you should create a symlink to PREFIX/lib/gcc-lib/PLATFORM/3.0.4/cc1plus.