Build:MozillaBuild For x64

From Mozilla x86-64

How to setup for x64 build environment. You cannot use same way of building 32-bit version. Also, for MSYS, see MSYS and Cygwin on x64 (AMD64) at first.

Recommend Compiler

I recommend that you use Visual Studio 2010 Service Pack 1 that uses offical Nightly build. Other version may have some problems with --enable-optimize.

Mozilla-Build

At first, download MozillaBuild package from https://developer.mozilla.org/en/Windows_Build_Prerequisites#MozillaBuild. MozillaBuild 1.4 or later supports x64 build environment.

Which script does I use to set the environment value?

  • start-msvc8-x64.bat for Visual Studio 2005
  • start-msvc9-x64.bat for Visual Studio 2008
  • start-msvc10-x64.bat for Visual Studio 2010
  • start-msvc11-x64.bat for Visual Studio 2012

Also, if you use Windows XP x64 or 2003 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=506323. You need modify batch file.

Sample .mozconfig file

This is a sample .mozconfig to build Firefox.

. $topsrcdir/browser/config/mozconfig

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32

Note that --target and --host have to set x86_64-pc-mingw32 due to no uname.exe for x64.

Compile Error by C2733

C:\Program Files\Microsoft Visual Studio 8\VC\include\intrin.h(912) : error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed
  C:\Program Files\Microsoft Visual Studio 8\VC\include\intrin.h(912) : see declaration of '_interlockedbittestandset'

To workaround this, comment out error line in intrin.h. See http://www.hydrogenaudio.org/forums/index.php?showtopic=50972.

Linker Error by LNK1103

uuid.lib(oldacc_i.obj) : fatal error LNK1103: debugging information corrupt; recompile module

See KB949009. You can download a hotfix from connect.microsoft.com.

Optimized Build

Visual Studio 2012

When using PGO, PGOCVT may throw internal error "PG0001". See https://connect.microsoft.com/VisualStudio/feedback/details/766253/.

Visual Studio 2010

When using PGO, 64-bit toolchain will crash (Internal Compile Error) due to linker bug. You need use 32-bit linker instead of. To use 32-bit toolchain to generate 64-bit binary, you must patch mozilla-build (See Bug 682788).

Visual Studio 2005

See KB976617. You may need this hotfix if using --enable-optimize.