- Mercurial 1.0 is needed to access source repositories. Make sure that the mq extension is enabled.
- SpiderMonkey provides scripting capabilities for Dehydra. For Mozilla static-checking builds, only the latest SpiderMonkey is supported.
- GCC 4.5, with the package gcc-4.5-plugin-dev installed. (GCC 4.3 may still work but is no longer supported. 4.3 will not work with static-checking builds.)
- A modern Linux distribution. Dehydra is not supported on Mac OS X.
It is recommended that you use Spidermonkey revision AURORA_BASE_20110705 when building Dehydra. Treehydra is unsupported with mozilla-central revisions older than 545a4745c09b.
cd $HOME hg clone http://hg.mozilla.org/mozilla-central/ hg update AURORA_BASE_20110705 mkdir $HOME/obj-js cd $HOME/obj-js $HOME/mozilla-central/js/src/configure --enable-optimize --disable-debug make
Building Dehydra and Treehydra
Building Dehydra requires SpiderMonkey development headers from the previous step. CXX should point to your system 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 http://hg.mozilla.org/rewriting-and-analysis/dehydra/ cd dehydra export CXX=/usr/bin/g++ ./configure \ --js-headers=$HOME/obj-js/dist/include \ --js-libs=$HOME/obj-js make # 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-arg-gcc_treehydra-script flags to specify the location of the plugin and the location of the analysis script:
g++ -quiet -fplugin=$HOME/dehydra/gcc_dehydra.so -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=../gcc_dehydra.so \ -fplugin-arg=a.js -fshort-wchar -fpreprocessed \ /home/dmandelin/builds/dehydra-gcc/browser/app/nsBrowserApp.ii -o /dev/null
-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.