Difference between revisions of "Instructions for Setting Up DXR"

From CDOT Wiki
Jump to: navigation, search
(noting the READM in DXR HG should be used now and not those steps)
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
--[[User:Jmdesp|Jmdesp]] 17:33, 3 April 2010 (EDT)
 +
 +
'''The instructions belows are outdated'''. Instead, you'd better just :
 +
 +
* hg clone http://hg.mozilla.org/webtools/dxr/ dxr
 +
 +
and then read and apply the content of the dxr/README file
 +
It's similar to what's below here, but with newer versions of the scripts, more functionalities (callgraph!), and full steps up to putting your DXR web site online.
 +
 +
 +
----
 
This page describes the steps necessary to manually create a working DXR.  The goal of this is to eventually be able to automate the process as part of an RPM for Fedora.
 
This page describes the steps necessary to manually create a working DXR.  The goal of this is to eventually be able to automate the process as part of an RPM for Fedora.
  
Line 25: Line 36:
 
** ../configure --prefix=~/dxr/tools/SpiderMonkey
 
** ../configure --prefix=~/dxr/tools/SpiderMonkey
 
** make
 
** make
** cd ..
+
** make install
  
 
* [https://developer.mozilla.org/en/Dehydra_GCC#Building_GCC_with_plugin_support_on_Linux Build GCC 4.3.0 with Plugin Support]
 
* [https://developer.mozilla.org/en/Dehydra_GCC#Building_GCC_with_plugin_support_on_Linux Build GCC 4.3.0 with Plugin Support]
Line 36: Line 47:
 
** hg clone http://hg.mozilla.org/users/tglek_mozilla.com/gcc-moz-plugin-mq .hg/patches
 
** hg clone http://hg.mozilla.org/users/tglek_mozilla.com/gcc-moz-plugin-mq .hg/patches
 
** (for file in `cat .hg/patches/series`; do cat .hg/patches/$file; done) |patch -p1
 
** (for file in `cat .hg/patches/series`; do cat .hg/patches/$file; done) |patch -p1
** cd ..  
+
** cd ..
 
** mkdir gcc-build
 
** mkdir gcc-build
 
** cd gcc-build
 
** cd gcc-build
Line 44: Line 55:
 
** make
 
** make
 
** make install
 
** make install
** cd .. (note: ./installed now contains the built gcc)  
+
** cd .. (note: ./installed now contains the built gcc)
  
 
* [https://developer.mozilla.org/en/Dehydra_GCC#Building_Dehydra Build Dehydra]
 
* [https://developer.mozilla.org/en/Dehydra_GCC#Building_Dehydra Build Dehydra]
 
** hg clone http://hg.mozilla.org/users/tglek_mozilla.com/dehydra-gcc/
 
** hg clone http://hg.mozilla.org/users/tglek_mozilla.com/dehydra-gcc/
 
** cd dehydra-gcc
 
** cd dehydra-gcc
** ./configure --js-libs=/home/dave/dxr/tools/SpiderMonkey/lib --js-headers=/home/dave/dxr/tools/SpiderMonkey/include --js-name=mozjs
+
** ./configure --js-libs=/home/dave/dxr/tools/SpiderMonkey/lib --js-headers=/home/dave/dxr/tools/SpiderMonkey/include/js --js-name=mozjs
 +
*** <strike>note use of --js-name=mozjs (see [https://bugzilla.mozilla.org/show_bug.cgi?id=478103 bug 478103])</strike> Pretty sure you can leave this out now.
 
** make
 
** make
  
NOTE: running |make check| causes a known failure that can be ignored for now:
+
NOTE: running '''make check''' causes a known failure that can be ignored for now:
  
 
  [dave@Germany dehydra-gcc]$ make check
 
  [dave@Germany dehydra-gcc]$ make check
Line 59: Line 71:
 
  python unit_test_harness.py dehydra "/home/dave/dxr/tools/gcc-dehydra/gcc-build/gcc/cc1plus -quiet -O1 -ftest-coverage -fplugin=../gcc_%s.so -o /dev/null -fplugin-arg=%s %s"
 
  python unit_test_harness.py dehydra "/home/dave/dxr/tools/gcc-dehydra/gcc-build/gcc/cc1plus -quiet -O1 -ftest-coverage -fplugin=../gcc_%s.so -o /dev/null -fplugin-arg=%s %s"
 
  ...x..................................
 
  ...x..................................
  Test Failure:  
+
  Test Failure:
 
     Test command: /home/dave/dxr/tools/gcc-dehydra/gcc-build/gcc/cc1plus -quiet -O1 -ftest-coverage -fplugin=../gcc_dehydra.so -o /dev/null -fplugin-arg=test_numinfo.js numinfo.cc
 
     Test command: /home/dave/dxr/tools/gcc-dehydra/gcc-build/gcc/cc1plus -quiet -O1 -ftest-coverage -fplugin=../gcc_dehydra.so -o /dev/null -fplugin-arg=test_numinfo.js numinfo.cc
 
     Failure msg: Expected 'OK' output; got 'ERR  TestCase  Error: 0ul != 0u'
 
     Failure msg: Expected 'OK' output; got 'ERR  TestCase  Error: 0ul != 0u'
+
 
 
  Unit Test Suite Summary:
 
  Unit Test Suite Summary:
 
       37 passed
 
       37 passed
Line 71: Line 83:
 
  make: *** [check] Error 2
 
  make: *** [check] Error 2
  
* Create a mozconfig to work with dehydra
+
* Get xref post-processing scripts (see [https://bugzilla.mozilla.org/show_bug.cgi?id=435814 bug 435814])
 
 
. $topsrcdir/browser/config/mozconfig
 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-opt
 
mk_add_options MOZ_MAKE_FLAGS=-j9
 
ac_add_options --enable-optimize --disable-debug
 
ac_add_options --disable-tests
 
# build with gcc+dehydra instead of normal g++
 
export CXX=$HOME/dxr/tools/gcc-dehydra/installed/bin/g++
 
export CXXFLAGS="-fplugin=$HOME/dxr/tools/gcc-dehydra/dehydra-gcc/gcc_dehydra.so -fplugin-arg=$HOME/dxr/mozilla-central/moz_types.js"
 
 
 
* TODO: add post-processing steps to create xref -- see [https://bugzilla.mozilla.org/show_bug.cgi?id=435814 bug 435814]
 
 
 
* Get xref post-processing scripts
 
 
** mkdir ~/dxr/tools/xref-scripts
 
** mkdir ~/dxr/tools/xref-scripts
 
** cd ~/dxr/tools/xref-scripts
 
** cd ~/dxr/tools/xref-scripts
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325316 -O class_schema.sql
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325316 -O class_schema.sql
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325314 -O build_db.sh
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325314 -O build_db.sh
 +
** Adjust paths for build_db.sh script:
 +
 +
SOURCEROOT=$HOME/dxr/mozilla-central/mozilla
 +
OBJDIR=${SOURCEROOT}/objdir-opt
 +
DEHYDRAROOT=$HOME/dxr/tools/xref-scripts
 +
DBROOT=$HOME/dxr/xref-db
 +
DBBACKUP=${DBROOT}-old
 +
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325317 -O fix_paths.pl
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325317 -O fix_paths.pl
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325318 -O process_xref.pl
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=325318 -O process_xref.pl
Line 101: Line 108:
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=337530 -O xpidl_xref.c
 
** wget https://bug435814.bugzilla.mozilla.org/attachment.cgi?id=337530 -O xpidl_xref.c
 
** cp xpidl_xref.c mozilla/xpcom/typelib/xpidl
 
** cp xpidl_xref.c mozilla/xpcom/typelib/xpidl
 +
 +
* Create a mozconfig to work with dehydra
 +
 +
. $topsrcdir/browser/config/mozconfig
 +
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-opt
 +
mk_add_options MOZ_MAKE_FLAGS=-j9
 +
ac_add_options --enable-optimize --disable-debug
 +
ac_add_options --disable-tests
 +
# build with gcc+dehydra instead of normal g++
 +
export CXX=$HOME/dxr/tools/gcc-dehydra/installed/bin/g++
 +
export CXXFLAGS="-fplugin=$HOME/dxr/tools/gcc-dehydra/dehydra-gcc/gcc_dehydra.so -fplugin-arg=$HOME/dxr/tools/xref-scripts/moz_types.js"
 +
 +
* cd ~/dxr/tools/xref-scripts
 +
* chmod +x *.pl
 +
* ./build_db.sh

Latest revision as of 16:33, 3 April 2010

--Jmdesp 17:33, 3 April 2010 (EDT)

The instructions belows are outdated. Instead, you'd better just :

and then read and apply the content of the dxr/README file It's similar to what's below here, but with newer versions of the scripts, more functionalities (callgraph!), and full steps up to putting your DXR web site online.



This page describes the steps necessary to manually create a working DXR. The goal of this is to eventually be able to automate the process as part of an RPM for Fedora.

  • mkdir ~/dxr
  • mkdir ~/dxr/tools
  • Setup a working Mozilla build environment:
    • su -c "yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'"
    • su -c "yum install mercurial autoconf213"
  • Setup a working GCC+plugins build environment
    • su -c "yum install mpfr-devel"
  • Build SpiderMonkey
    • cd ~/dxr/tools
    • link or copy js/ from the mozilla-central tree (cp -R ~/dxr/mozilla-central/mozilla/js/ ./js)
    • cd ~/dxr/tools/js/src
    • autoconf-2.13
    • mkdir build-release
    • cd build-release
    • ../configure --prefix=~/dxr/tools/SpiderMonkey
    • make
    • make install
  • Build GCC 4.3.0 with Plugin Support
    • mkdir ~/dxr/tools/gcc-dehydra
    • cd ~/dxr/tools/gcc-dehydra
    • Obtain GCC 4.3 sources - wget ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-4.3.0/gcc-4.3.0.tar.bz2
    • tar jxvf gcc-4.3.0.tar.bz2
    • cd gcc-4.3.0/
    • hg init .
    • hg clone http://hg.mozilla.org/users/tglek_mozilla.com/gcc-moz-plugin-mq .hg/patches
    • (for file in `cat .hg/patches/series`; do cat .hg/patches/$file; done) |patch -p1
    • cd ..
    • mkdir gcc-build
    • cd gcc-build
    • build for proper arch:
      • (32 bit) ../gcc-4.3.0/configure --without-libstdcxx --enable-checking --disable-bootstrap CFLAGS="-g3 -O0" --enable-languages=c,c++ --enable-__cxa_atexit --prefix=$PWD/../installed
      • (x86_64) ../gcc-4.3.0/configure --without-libstdcxx --enable-checking --disable-bootstrap CFLAGS="-g3 -O0 -m64" --enable-languages=c,c++ --disable-multilib --enable-__cxa_atexit --prefix=$PWD/../installed
    • make
    • make install
    • cd .. (note: ./installed now contains the built gcc)

NOTE: running make check causes a known failure that can be ignored for now:

[dave@Germany dehydra-gcc]$ make check
make -C test check
make[1]: Entering directory `/home/dave/dxr/tools/gcc-dehydra/dehydra-gcc/test'
python unit_test_harness.py dehydra "/home/dave/dxr/tools/gcc-dehydra/gcc-build/gcc/cc1plus -quiet -O1 -ftest-coverage -fplugin=../gcc_%s.so -o /dev/null -fplugin-arg=%s %s"
...x..................................
Test Failure:
    Test command: /home/dave/dxr/tools/gcc-dehydra/gcc-build/gcc/cc1plus -quiet -O1 -ftest-coverage -fplugin=../gcc_dehydra.so -o /dev/null -fplugin-arg=test_numinfo.js numinfo.cc
   Failure msg: Expected 'OK' output; got 'ERR  TestCase   Error: 0ul != 0u'
Unit Test Suite Summary:
     37 passed
      1 failed
      0 error(s)
make[1]: *** [check_dehydra] Error 1
make[1]: Leaving directory `/home/dave/dxr/tools/gcc-dehydra/dehydra-gcc/test'
make: *** [check] Error 2
SOURCEROOT=$HOME/dxr/mozilla-central/mozilla
OBJDIR=${SOURCEROOT}/objdir-opt
DEHYDRAROOT=$HOME/dxr/tools/xref-scripts
DBROOT=$HOME/dxr/xref-db
DBBACKUP=${DBROOT}-old
  • Create a mozconfig to work with dehydra
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-opt
mk_add_options MOZ_MAKE_FLAGS=-j9
ac_add_options --enable-optimize --disable-debug
ac_add_options --disable-tests
# build with gcc+dehydra instead of normal g++
export CXX=$HOME/dxr/tools/gcc-dehydra/installed/bin/g++
export CXXFLAGS="-fplugin=$HOME/dxr/tools/gcc-dehydra/dehydra-gcc/gcc_dehydra.so -fplugin-arg=$HOME/dxr/tools/xref-scripts/moz_types.js"
  • cd ~/dxr/tools/xref-scripts
  • chmod +x *.pl
  • ./build_db.sh