This is an archived page. It's not actively maintained.

Installing Dehydra


  • Mercurial 1.0 is needed to access source repositories. Make sure that the mq extension is enabled.
  • SpiderMonkey provides scripting capabilities for Dehydra.
  • GCC 4.5, with the package gcc-4.5-plugin-dev installed. (Alternately, build from source)
  • A modern Linux distribution. Dehydra is not supported on Mac OS X.

Building SpiderMonkey

It is recommended that you use SpiderMonkey revision AURORA_BASE_20110705 when building Dehydra.

cd $HOME
hg clone
cd mozilla-central
hg update AURORA_BASE_20110705
cd js/src
mkdir $HOME/obj-js
cd $HOME/obj-js
$HOME/mozilla-central/js/src/configure --enable-optimize --disable-debug

It has to be checked whether later/newer branches (like AURORA_BASE_20120131) are working, too.

Please also note that autoconf v2.13 is really needed: it does not work with e.g. v2.68.

There is no need for some installation after make.

You can skip the next section "Building GCC 4.5" if you are using gcc 4.6 or above.

Building GCC 4.5

For Treehydra's process_tree_decl to work, when compiling with g++, you must use a patched GCC 4.5 before building Dehydra.

cd $HOME
# obtain GCC 4.5.3 (see for alternate mirrors)
tar -jxvf gcc-4.5.3.tar.bz2

# apply PLUGIN_FINISH_DECL patch
wget https://bug559964.bugzilla.mozilla.o....cgi?id=457606 -O finish_decl.diff
cd gcc-4.5.3
patch -p0 < ../finish_decl.diff

# build GCC
cd ..
mkdir gcc-objdir
mkdir gcc-dist

cd gcc-objdir
../gcc-4.5.3/configure --disable-bootstrap --enable-languages=c,c++ --prefix=$PWD/../gcc-dist
make install

Building Dehydra and Treehydra

Building Dehydra requires SpiderMonkey development headers from the previous step. CXX should point to your copy of GCC 4.5.

It is recommended to get the latest Dehydra sources by checking out from Mercurial. (Obsolete Dehydra releases can be found on the Mozilla ftp site.)

hg clone
cd dehydra
export CXX=/usr/bin/g++
./configure \
   --js-headers=$HOME/obj-js/dist/include \

# run dehydra and treehydra tests
make check


Dehydra checking can be performed directly within the Mozilla build. To enable static checking of a Mozilla build, see Building with static checking.

To run Dehydra manually using G++, add the -fplugin and -fplugin-arg-gcc_dehydra-script/-fplugin-arg-gcc_treehydra-script flags to specify the location of the plugin and the location of the analysis script:

g++ -quiet -fplugin=$HOME/dehydra/ -fplugin-arg-gcc_dehydra-script=$DEHYDRA_SCRIPT \
  -fshort-wchar $CPPFILE -S -o /dev/null

For example, in the tests directory created by the installation procedure, I can run a Dehydra script 'a.js' on a Mozilla file like this:

g++ -quiet -fplugin=../ \
-fplugin-arg=a.js -fshort-wchar -fpreprocessed \
/home/dmandelin/builds/dehydra-gcc/browser/app/nsBrowserApp.ii -o /dev/null

The -fshort-wchar is required for running against Firefox, but not necessarily for other codebases.

To generate preprocessed Mozilla source files (*.ii), see the Pork Install Instructions.

See Also