Page 1 of 1

Build instructions for Pale Moon (Windows + VS2012 Express)

Posted: 2014-04-05, 11:38
by Moonchild
Note: these instructions don't apply to the current version of Pale Moon. they are kept as an archived post. Please see elsewhere for current build instructions.
Trying to build from master/trunk on the repository using these instructions will fail.

To build your own copy of Pale Moon from source on Windows, using the free version of Visual Studio 2012, you will need to do the following.
Most of these instructions are universal for building x86 and x64, so I will indicate differences required for x64 at the steps they are required.

Install prerequisites
  • Make sure you have powerful enough hardware running Windows 7 SP1 or above (at least dual-core full-fledged processor, at least 4GB of Ram (8 or more recommended), at least 20GB of free disk space). Don't try to build on a laptop. If you are even considering doing this, stop. You need a development-class computer to build Pale Moon.
  • Visual Studio 2012 Express: http://www.microsoft.com/en-us/download/details.aspx?id=34673
    Launch VS2012 after installation to initialize the environment, start the IDE and get the latest updates (Update 4 at the time of this writing). Launch after updating to finish up the update, after which you can close the IDE. For x64 builds, make sure you install the x64 build tools.
    (Note: You will be asked to register with Microsoft when launching it the first time. If you want to continue using VS2012 Express after 30 days, I strongly recommend you do so immediately and get it out of the way. Skipping this step will give you a 30-day evaluation period after which VS2012 Express will cease to work.)
  • June 2010 DirectX SDK: http://www.microsoft.com/download/en/details.aspx?id=6812
    When installing, make sure to also install the runtime libraries (do not uncheck them). Samples and documentation are optional.
    (Note that other versions of the DirectX SDK on Microsoft's Developer Center that claim to have been released after June 2010 are actually older versions that are misdated, some of which will result in an error if you try and download them due to the installer files themselves having been removed from the MS servers. There will not be any further standalone DirectX SDKs released by MS, since DirectX has been transitioned from an independent distribution model to an integrated (into Windows and Visual Studio) model, and the DirectX SDK is now integrated into the Windows 8 SDK (which is bundled with Visual Studio as of VS2012). The reason that we require the June SDK even on newer Win7+VS2012 systems is because ANGLE depends on D3DX9, but MS considers D3DX to have been obsoleted by newer technologies and therefore VS2012 doesn't include the d3dx9.h and d3dx9tex.h headers that are required to compile ANGLE.)

    Caveat:
    If installation fails with an "S1023" error, execute the following commands to remove the VC++ 2010 redistributable libraries from your computer:

    Code: Select all

    MsiExec.exe /passive /X{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}
    MsiExec.exe /passive /X{1D8E6291-B0D5-35EC-8441-6616F567A0F7}
    Then install the DirectX SDK again. After installation has completed, you can re-install the VC++ redistributable libraries from http://www.microsoft.com/download/en/details.aspx?id=26999
  • The MozillaBuild 1.10 package: https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.10.0.exe
    Install it in the recommended location, or a different path that has no spaces in it.
    The "latest" package will not work, since Python has been upgraded in 1.11+ that has breaking changes with the build system used in the Pale Moon source tree.
Contrary to some instructions on the 'web, you do not need the Windows 7.1 SDK, not even for building for Windows XP machines. This is not required for VS2012 versions (that come with the Win8 SDK integrated) and will actually complicate matters and may break your build. Please do not install the Win 7.1 SDK.

Get the source

Download the source from http://www.palemoon.org/sourcecode.shtml
Unpack the source code (using 7-zip) to a path that does not contain spaces, e.g. c:\palemoon-source

This source tree will contain everything needed for both x86 and x64 builds of Pale Moon (they share the same release source code).

Configure

Create a file called .mozconfig in the source folder you unpacked the source in.
(Yes, that is {dot}mozconfig -- don't omit the . at the start. Also make sure it's not .mozconfig.txt or something crooked like that. If you are hiding extensions of known file types, fix that first in folder options because it's a PITA when trying to do this kind of thing)
Make sure it contains at least the following for a close-to-official build:

For x86 (32-bit):

Code: Select all

mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser
ac_add_options --enable-optimize="-O2"
ac_add_options --enable-jemalloc

WIN32_REDIST_DIR=$VCINSTALLDIR/redist/x86/Microsoft.VC110.CRT
For x64 (64-bit):

Code: Select all

ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser
ac_add_options --enable-optimize="-O2"
ac_add_options --enable-jemalloc
ac_add_options --enable-shared-js

WIN32_REDIST_DIR=$VCINSTALLDIR/redist/x64/Microsoft.VC110.CRT
Build
  • Go to C:\mozilla-build (or wherever you extracted to mozilla build tools) and run start-shell-msvc2012.bat
    This will open a UNIX-like shell with the compile environment set up for Visual Studio 2012. Please do not use the -x64 batch file even if you are on a 64-bit operating system when building x86.

    The -x64 batch file is for launching a 64-bit build environment and building a 64-bit browser using a 64-bit compiler. So for creating an x64 build of Pale Moon, run start-shell-msvc2012-x64.bat
  • In the shell, cd to your pale moon source directory, e.g. cd /c/palemoon-source if you installed the source in C:\palemoon-source
  • Start the build:./mach build
  • Be patient. Building will take a long time. Your PC will be fully occupied compiling and linking the browser (you can expect 100% CPU usage throughout and lots of memory use - provide ample cooling) and you should not be using it for anything else that is intensive at this time. Especially memory-intensive applications should be avoided because it can cause issues with the linker (memory fragmentation) resulting in a very unstable browser.
Important note: before you start building, make sure to exclude the source and target folders from antivirus software or it will severely slow down the build process or may even break it entirely (due to file locks). Either completely disable real-time/on-access scanning before building, or make specific exclusions for your working folders.

Strip/Package

After building is completed, you can take the resulting binaries for a test run in the object directory directly (see the on-screen instructions at the end of the build process) but it will not be complete yet. You need to strip and package the browser to integrate additional code and have a ready-to-use browser. You do this by running ./mach package
This will create a properly packaged .zip file in your object folder under the Pale Moon source folder. e.g.:
C:\palemoon-source\obj-i686-pc-mingw32\dist\palemoon-{version}.en-US.win32.zip (for x86)

Building a self-extracting installer

If you want to build a self-extracting installer, similar to the off-line installers offered in official builds, you will have to do give the following command:
./mach installer
This will create a self-extracting installer in your object folder under the Pale Moon source folder. e.g.:
C:\palemoon-source\obj-i686-pc-mingw32\dist\install\sea\palemoon-{version}.en-US.win32.installer.exe (for x86)

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-04-28, 18:10
by tribaljet
With this thread being continuously updated, it might help people do system-specific builds, such as SSE4.x and AVX builds. If such builds were to surface, would they be made available alongside the Atom-optimized builds?

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-04-28, 23:18
by Moonchild
tribaljet wrote:With this thread being continuously updated, it might help people do system-specific builds, such as SSE4.x and AVX builds. If such builds were to surface, would they be made available alongside the Atom-optimized builds?
I welcome contributed builds. But people do have to go through the proper procedure to be allowed to distribute their builds with official Pale Moon branding; no rogue copies, thanks.

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-04-28, 23:58
by tribaljet
Moonchild wrote:I welcome contributed builds. But people do have to go through the proper procedure to be allowed to distribute their builds with official Pale Moon branding; no rogue copies, thanks.
But of course, nor would I ever think of not following proper procedure. Will the thread expand further in terms of instructions as to make it easier for people inexperienced with handling new builds?

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-04-29, 11:49
by Accel
I, myself interested to build pm for my own use using SSE4.1 / AVX.

may i know how to do this, MC? is this instruction right?

ac_add_options --enable-optimize="-O2 -GFLs -GS- -fp:precise -Qfast_transcendentals -Qpar -arch:SSE3 -QaxCORE-AVX2,CORE-AVX-I,AVX,SSE4.2,SSE4.1,SSSE3,SSE3,SSE2"

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-04-29, 13:38
by Moonchild
You can't use those optimization flags. You have to use the optimization flags available in the Visual Studio compiler.
If you want to compile with a different compiler (I think the flags you quoted are for the Intel compiler?) then you'll have to look around for build instructions for that compiler on the 'net.

MSVC2012 however does support -arch:AVX which would automatically imply more advanced SSE instruction sets.
http://msdn.microsoft.com/en-us/library ... 10%29.aspx

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-04-29, 14:20
by Accel
thanks MC for your reply.. now it starts.. :)

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-04-29, 20:19
by tribaljet
Will this tutorial include x64 build instructions as well in the future?

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-05-22, 14:31
by Accel
is there an easy way to make palemoon installer?

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-05-22, 16:20
by Moonchild
tribaljet wrote:Will this tutorial include x64 build instructions as well in the future?
Yup.
Accel wrote:is there an easy way to make palemoon installer?
I've added some instructions at the end to create an installer. I assume that is what you meant.

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2014-07-10, 09:46
by Moonchild
tribaljet wrote:Will this tutorial include x64 build instructions as well in the future?
I've just updated the instructions to include x64 building :)

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2015-12-30, 10:51
by kormoran
Would be useful to add that Win7 explorer won't allow you to create or rename a file to ".mozconfig", because it seems a "no name" file with just the extension, to him. You must create a normal file then open cmd.exe (or whatever CLI you use) and rename it :problem:

Re: Build instructions for Pale Moon (Windows + VS2012 Expre

Posted: 2015-12-30, 11:03
by squarefractal
kormoran wrote:Win7 explorer won't allow you to create or rename a file to ".mozconfig", because it seems a "no name" file with just the extension
Try creating a file named .mozconfig. (with a dot at the end), it'll be autorenamed to .mozconfig

Re: Build instructions for Pale Moon (Windows + VS2012 Express)

Posted: 2016-07-30, 22:59
by Mercury
Since Pale Moon v27 (Tycho) uses VS2013 these instructions will need to be updated.

Are we still using MozillaBuild version 1.10? And the same DirectX SDK as before?

Re: Build instructions for Pale Moon (Windows + VS2012 Express)

Posted: 2016-07-30, 23:02
by Moonchild
Mercury wrote:Since Pale Moon v27 (Tycho) uses VS2013 these instructions will need to be updated.
Are we still using MozillaBuild version 1.10? And the same DirectX SDK as before?
Pale Moon 27 is not released yet.

Re: Build instructions for Pale Moon (Windows + VS2012 Express)

Posted: 2016-07-31, 10:18
by New Tobin Paradigm
Build instructions for Pale Moon 26 are now located here: http://developer.palemoon.org/Developer_Guide:Build_Instructions/Pale_Moon/Windows

Tycho requires some drastic changes including vs2013 and some important mozconfig changes and a at least version 2.0 of the mozillabuild toolchain. However, as this is very early alpha quality a lot of things are in flux and nothing on how it is built nor the code it's self is set in stone..

If you ARE really anxious to start building now? Try looking at about:buildconfig and work it out. But know.. You are even more on your own than you would be building a currently released codebase. Don't come to us when building Tycho causes your washing machine to merge with your microwave and eats your cat. k?

Re: Build instructions for Pale Moon (Windows + VS2012 Express)

Posted: 2016-07-31, 13:29
by Fedor2
Can you please tell detailed about these mozconfig changes. Though could not finde good info about mozconfig on the mozilla itself. As i have studied these settings substitutes some configure settings.
Don't come to us when building Tycho causes your washing machine to merge
Something like that? Once i set enable debug and symbols and got 900mb xul.dll, of course it fails to run.

And i used old mozilla build tools and it fails just before the end on some installer stuff, so there are everything else got built.

Re: Build instructions for Pale Moon (Windows + VS2012 Express)

Posted: 2016-07-31, 15:43
by New Tobin Paradigm
So I have to ask.. What do you believe "not set in stone" and "on your own" means?

If you can't work it out perhaps you shouldn't be building source code... We will provide up to date instructions at a later time and when we feel doing so is appropriate.

We are under no obligation to hold your hand here. Our support extends to release versions built by us in binary form. Not the source code and certainly not work in progress code in either source or binary form.

Any further than that is a courtesy at our discretion and one we do not have to provide especially on demand.