Menu

firefox5VC2010

Anonymous

How to build firefox5.0 with jemalloc using VC2010

This wiki page tells you the steps to firefox5.0 with jemalloc using VC2010.


Steps 0

You must have available VC2010 and VC2008 (for VC2008, we only need its vc/crt/src).

You must have Microsoft DirectX SDK (June 2010), and you can download from http://www.microsoft.com/downloads/en/details.aspx?familyid=3021d52b-514e-41d3-ad02-438a3ba730ba

You must have mozilla-build tools, and you can download latest edition from http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe

You can download the Firefox5.0 source code from ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/5.0/source/firefox-5.0.source.tar.bz2

Unzip the file to a directory, for example,

E:\mozilla

Here I recommend you to unzip directory named mozilla, for avoiding some detect errors.

Run mozilla-build/start-msvc10.bat

$ cd /e/mozilla

If you want to compile firefox with jemalloc, before building firefox, you must rename vc2010/vc/crt/src to vc2010/vc/crt/src-2010, and then you should copy vc2008/vc/crt/src to vc2010/vc/crt/src.


Steps

1 Preparing your .mozconfig

Edit new file named myconfig as follows:

. $topsrcdir/browser/config/mozconfig

mk_add_options MOZ_MAKE_FLAGS=-j1

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obju

export MOZ_OPTIMIZE_LDFLAGS="-opt:ref,icf"
mk_add_options MOZ_OPTIMIZE_LDFLAGS="-opt:ref,icf"

ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --enable-installer
ac_add_options --with-branding=browser/branding/unofficial

ac_add_options --enable-extensions=default
ac_add_options --enable-strip
# for Athlon 64/Pentium 4/
ac_add_options --enable-optimize="-O2 -Ot -Ob2 -Oy -GF -GL -arch:SSE2"

# diasble updater
ac_add_options --disable-updater
ac_add_options --disable-update-channel

# diasble crashreporter
ac_add_options --disable-crashreporter

#enable jemalloc
ac_add_options --enable-jemalloc

# for debug
ac_add_options --enable-debugger-info-modules=no

# for auto pgo build
mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) $(MOZ_OBJDIR)/_profile/pgo/profileserver.py'

ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --disable-auto-deps

Then save and close myconfig, and input the orders in mozilla msys shell:

mv myconfig .mozconfig

You should put the .mozconfig file to E:/mozilla/

2 Patching configure script to bypassing jemalloc VC2005 or VC2008 detecting

Modify E:/mozilla/configure script line 20272 to 21274.

        if test "$CC_VERSION" < "14.00.50727.762" -a "$CC_VERSION" < "15.00.30729.01"; then
        { echo "configure: error: Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently." 1>&2; exit 1; }
    fi

Modify the block to

   #     if test "$CC_VERSION" < "14.00.50727.762" -a "$CC_VERSION" < "15.00.30729.01"; then
   #     { echo "configure: error: Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently." 1>&2; exit 1; }
   # fi

2 Building and modifying

make -f client.mk profiledbuild

After makefile pruduced, you should modify some makefile as follows

E:\obju\memory\jemalloc\makefile line 76 block

to

# patch if necessary
CRTDIFF=crtvc9sp1-$(MOZ_CRT_CPU_ARCH).diff

E:\obju\gfx\angle\src\libEGL\makfile line 140

EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/dxguid.lib" $(DIST)/lib/libGLESv2.lib

to

EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/dxguid.lib" $(DIST)/lib/libGLESv2.lib msvcprt.lib

E:\obju\gfx\angle\src\libGLESv2\makefile line 152

EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3dx9.lib"

to

EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3d9.lib" "$(MOZ_DIRECTX_SDK_PATH)/lib/x86/d3dx9.lib" msvcprt.lib

E:\obju\toolkit\library\makefile line 148

EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB)

to

EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB) msvcprt.lib

3 Waiting

......

cd /e/obju
make package

In the end, you will get the Firefox5 package in E:\obju\dist\firefox-5.0.en-US.win32.zip.


Enjoy it.


About improvement and stability

1 -fp:fast

tete009 said, in his experience, using -fp:fast option for compiling Firefox can cause unexpected bugs.

http://tete009.seesaa.net/article/100491563.html#A100491563 (Japanese)

So if I can find some errors, I will abandon the option's use. I will abandon the option in next release edition.

2 With betterpgo

I use some ways below:

for example, I create a new sub directory called betterpgo in ff-src/build/pgo

I add the V8 test to /betterpgo's, take an example, write a new index.html

             <head>
              <meta http-equiv="refresh" content="0;url=http://v8.googlecode.com/svn/data/benchmarks/v6/run.html" />
             </head>

and modify ff-src/build/pgo/index.html

               "js-input/string-tagcloud.html",
               "js-input/string-unpack-code.html",
               "js-input/string-validate-input.html",
               + "betterpgo/index.html"

and copy betterpgo to obj/_profile/pgo

then make -f client.mk profiledbuild

the result is the V8 score may be greater.


Related

Wiki: Guide

Discussion

  • Anonymous

    Anonymous - 2011-07-11

    Originally posted by: name.is....@gmail.com

    hello !

    why --enable-optimize="-O2 intead of --enable-optimize="-O3 ??

     
  • Anonymous

    Anonymous - 2011-08-11

    Originally posted by: s793...@gmail.com

    謝謝您的教程。我照著作成功編譯了 Seamonkey 2.2 with OLD jemalloc. Thanks for your tutorial. I just compiler seamonkey 2.2 with OLD jemalloc succssful.

     
  • Anonymous

    Anonymous - 2011-08-15

    Originally posted by: xunxun1...@gmail.com

    There is no "-O3" in VC.

     
  • Anonymous

    Anonymous - 2011-08-15

    Originally posted by: xunxun1...@gmail.com

    现在mozilla已经修复了ff使用vc2010平滑编译jemalloc的问题 你可以参见 https://bugzilla.mozilla.org/show_bug.cgi?id=515492 中的补丁

    我抽空会重写这个编译教程,到时会把这个补丁提取出来。

     
  • Anonymous

    Anonymous - 2011-08-20

    Originally posted by: s793...@gmail.com

    上上週參考了 ayakawa 的 jemalloc 補丁後發現還是編譯失敗,看了一下 log 發現少了兩個檔,需自己手動增加。

    上週編了 seamonkey 2.3 成功,今天把 mozjs pgo 部份打開重新編譯了一次。

    https://sites.google.com/site/s7930162/

    ps: 我只編 Seamonkey XD

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.