Meet Mr. DTrace - Part 4

dtrace

Eventually, we got the building environment working. Thanks to Ben and help from #gnusol, the missing piece is sunwbtool

Using OpenSolaris binutils

Make sure you are using the OpenSolaris toolchain instead of GNU’s, otherwise the ld may crash with objects compiled with cc. Be cautious to you environment variable $PATH, and make sure /usr/ccs/bin and $SUNWspro/bin precede the generic /usr/bin.

And copy this configuration to your $HOME/.mozconfig, copied from Alex

. $topsrcdir/browser/config/mozconfig

ac_add_options --prefix=/opt/firefox
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-auto-deps
ac_add_options --disable-freetype2
ac_add_options --enable-official-branding
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --enable-optimize="-xO5 -xc99=no\_lib"
ac_add_options --enable-static
ac_add_options --disable-shared
ac_add_options --enable-xft
ac_add_options --enable-svg

Building, building, building…

Run the following commands:

./configure
gmake

wait it to fail

cd config; gmake
cd ../js; gmake

If it works, we can apply the patch to add static probes:

cd js/src; patch -p2

If you are in luck, you could get libmozjs.so. Now we need to preload it using run-firefox.sh:

libmozjs=/export/home/bookstack/work/firefox-1.5.0.7/trunk/js/src/libmozjs.so
export LD_PRELOAD=$libmozjs
export LD_LIBRARY_PATH=/usr/lib/firefox
export MOZ_PLUGIN_PATH=/usr/lib/firefox/plugins
/usr/lib/firefox/firefox-bin -UILocale C -contentLocale c
/usr/lib/firefox/firefox-bin

Unfortunately, there is a core dump when loading the libmozjs.so whenever the dtrace support is added. I doubt that the Firefox in NexentaOS is built by GCC, and it is not binary compatible with the SunStudio, I might have to build the whole Firefox. Ooooh, that is painful, I even does not do that in my Gentoo Linux…

Another bad news is SunStudio could not parse glib’s head file since it does not support GCC extension, even with c99 enabled. I might ask some guru in mozdev mailing list about how to build Firefox with SunStudio 11.