Meet Mr. DTrace – Part 4
Web April 30th, 2007
Eventually, we got the building environment working. Thanks to Ben and help from #gnusol, the missing piece is sunwbtool. We are going to build the Firefox first, then apply the patch to enable static probes in Javascript.
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 careful to you $PATH, and check whether /usr/ccs/bin and $SUNWspro/bin is preferred over the generic /usr/bin.
And copy this configuration to your $HOME/.mozconfig, copied from Alex
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:
gmake
#wait it to fail
cd config; gmake
cd ../js; gmake
If it works, we can apply the patch to add static probes:
gmake jsdtrace.o
gmake
If you are in luck, you could get libmozjs.so. Now we need to preload it, using run-firefox.sh
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 whatever 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.