Static Analysis/Installing the Oink Stack: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
m (Reverted edits by Firefoxer2011 (Talk) to last revision by Benjamin Smedberg)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is a kinda rough scratchpad for how to install and use the oink stack on a Linux system to do [[Static Analysis]].
#REDIRECT [[MDC:Installing Pork]]
 
Base system: FC7
 
== Install GCC 3.4 ==
 
<pre>sudo yum install compat-gcc-34
sudo yum install compat-gcc-34-c++</pre>
 
You may want to do a test-build of Mozilla at this point to make sure that it builds and links correctly.
 
== Build and Install MCPP ==
 
<pre>svn co https://mcpp.svn.sourceforge.net/svnroot/mcpp/trunk mcpp
cd mcpp
./configure --enable-replace-cpp CC=gcc34 CXX=g++34
make
sudo make install</pre>
 
== Get Spidermonkey ==
 
System spidermonkey is used by dehydra:
 
sudo yum install js-devel
 
''(The corresponding <code>apt-get</code> command had the curious side effect of removing 30 packages from my system, including little things like <code>firefox</code> and <code>gnome-terminal</code>. --[[User:Jorend|jorendorff]] 13:38, 19 October 2007 (PDT))''
 
''(I haven't been able to install js-devel through a package manager on my systems. I used a standalone js source distro from http://www.ossp.org/pkg/lib/js/).
--[[User:dmandelin]]''
 
== Do the oink thing ==
 
wget http://people.mozilla.org/~tglek/checkout.sh
sh checkout.sh http://hg.mozilla.org
 
Now, depending on your version of hg, you may need to manually update the working directory for elsa and elkhound:
 
hg -R oink-stack/elkhound update -C tip
hg -R oink-stack/elsa update -C tip
hg -R oink-stack/oink update -C tip
 
Build it.
 
cd oink-stack
./configure
make
 
== Building Mozilla with MCPP ==
 
To build Mozilla with MCPP to generate annotated .ii files, use the following configure command:
 
ac_cv_visibility_hidden=no CC="gcc34 -save-temps -Wp,-W0,-K" CXX="g++34 -save-temps -Wp,-W0,-K" CPPFLAGS=-DNS_DISABLE_LITERAL_TEMPLATE $srcdir/configure --enable-debug --disable-optimize --disable-accessibility --enable-application=browser --disable-crashreporter
 
Building will probably require disabling WARNINGS_AS_ERRORS:
 
make WARNINGS_AS_ERRORS=
 
== Building a 32-bit MCPP on a 64-bit system ==
 
This is dark magic, and I hope I've got it right. First I built GCC in a separate <tt>--prefix=/builds/gcc-3.4.6-installed</tt>. <em>Note: once you do this, you can only use this version of GCC in -m32 mode.</em>
 
Apply this patch:
 
<pre>Index: src/set_mcpp.sh
===================================================================
--- src/set_mcpp.sh    (revision 78)
+++ src/set_mcpp.sh    (working copy)
@@ -35,14 +35,14 @@
echo "  cd ${inc_dir}/mcpp-gcc"
cd ${inc_dir}/mcpp-gcc
if test ! -f gcc${gcc_maj_ver}${gcc_min_ver}_predef_std.h; then
-    echo "  generating g*.h header files"
-    ${CC} -E -xc -dM /dev/null | sort | grep ' *#define *_'      \
+    echo "  generating g*.h header files: ${CPPFLAGS}"
+    ${CC} ${CPPFLAGS} -E -xc -dM /dev/null | sort | grep ' *#define *_'      \
            > gcc${gcc_maj_ver}${gcc_min_ver}_predef_std.h
-    ${CC} -E -xc -dM /dev/null | sort | grep -E ' *#define *[A-Za-z]+'    \
+    ${CC} ${CPPFLAGS} -E -xc -dM /dev/null | sort | grep -E ' *#define *[A-Za-z]+'    \
            > gcc${gcc_maj_ver}${gcc_min_ver}_predef_old.h
-    ${CXX} -E -xc++ -dM /dev/null | sort | grep ' *#define *_'    \
+    ${CXX} ${CPPFLAGS} -E -xc++ -dM /dev/null | sort | grep ' *#define *_'    \
            > gxx${gcc_maj_ver}${gcc_min_ver}_predef_std.h
-    ${CXX} -E -xc++ -dM /dev/null | sort | grep -E ' *#define *[A-Za-z]+' \
+    ${CXX} ${CPPFLAGS} -E -xc++ -dM /dev/null | sort | grep -E ' *#define *[A-Za-z]+' \
            > gxx${gcc_maj_ver}${gcc_min_ver}_predef_old.h
fi
if test ${host_system} = SYS_CYGWIN; then</pre>
 
If you don't do this, MCPP will get the wrong set of automatic definitions and you'll end up with an unpleasant hybrid x86-64/i686 build system.
 
<pre>$ export PATH=/builds/gcc-3.4.6-installed/bin:$PATH
$ export CPPFLAGS=-m32
$ CC=gcc34 CXX=g++34 CPPFLAGS=-m32 LDFLAGS=-m32 ../src/configure --enable-replace-cpp --prefix=/builds/gcc-3.4.6-installed  --target=i686-pc-linux
$ make
$ make install program_transform_name=</pre>

Latest revision as of 21:51, 13 May 2010