Microsoft Visual C++ toolkit build instructions

Discussion of third-party/unofficial Firefox/Thunderbird/SeaMonkey builds.
Post Reply
nrthomas
Posts: 1988
Joined: February 9th, 2003, 3:25 pm

Post by nrthomas »

Tiermann,

The tarballs don't have the Firefox and Thunderbird directories so you need to use CVS to pull them.

Flowchart:

Did you download a tarball, or want to update the source tree ?
--> make -f client.mk checkout

Do you want to just build your complete tree ?
--> make -f client.mk build

Do you want to update and build in one step ?
--> make -f client.mk
User avatar
TierMann
Posts: 184
Joined: March 29th, 2004, 10:18 am
Location: Sitting here, posting to fourms.
Contact:

Post by TierMann »

Ah, thanks. Knew I was forgeting something

I usually just pull everything.

Changed the build page for that info.
User avatar
Waldo
Posts: 596
Joined: July 29th, 2003, 8:21 am
Location: Cambridge, MA
Contact:

Post by Waldo »

I've also written some instructions on the process of setting up this free build environment (it was mostly done when TierMann posted his, so I figured I'd finish mine up anyways for thoroughness of documentation - target audience is a little different as well). I hit a little snag when I screwed up the environment variables by omitting the ones with paths in the Visual Studio .NET directory (I thought it was just a leftover from his previous environment until I actually checked that the folders were non-empty and existent), but the build is progressing merrily right now (perhaps in three hours it'll be done - I need a newer computer).

What differences exist? Well, mine are more anal and should be better for a complete newbie (like me) or a person who wants a list of things to do with nothing left to guessing. They also use ActivePerl instead of cygwin perl, so building the installer version *should* be possible with this environment (haven't tested - may try after the first build completes). They try to segregate the build tools as much as possible from the main drive C: so a dabbler won't leave a train wreck in his default drive if he chooses to back out the build environment. They also are probably redundant in some areas based on the post several back about how the VC toolkit included something else as well (help clarifying that is appreciated). They set up a complete build environment and should be freestanding (they don't rely on the Mozilla Win32 build guide). My instructions provide a direct link for every download where such is possible, attempting to avoid any possible searching online. I also have a patch to enable building from a very recent (hours old at most) trunk, which is applied as part of the instructions (no more patching by hand). They also describe how to set up the build environment so no build script except client.mk needs to be run.

I think that covers all the differences. Feel free to use these instructions in any way you want, including integrating them with TierMann's or editing them for errors/redundancies/etc. Some credit would be nice, but mostly I've just documented the process of following TierMann's work in previous posts and setting up the other aspects of a build environment (which I've done numerous times). Now, for the instructions (a simple cut-n-paste - I agree that formatting on the forums is definitely evil, so I'm not bothering - if anything's lost in the copy, give a shout and I'll make it pretty):

=============================================

This is a COMPLETE build setup from nothing but a Windows command line to a full-fledged build system. If you've ever downloaded source you likely have some of this. I've tried to get stuff working from a non-clean system; it's always failed, so I'm doing this one from scratch (mostly -- to be really from scratch I should have backed up my files, wiped the system, and reinstalled Windows -- it's not yet time for that now, tho). YMMV if you go from existing. (For that matter, YMMV no matter what...)

For Windows XP; modify as appropriate for your recent WinNT-based platform. Most of the required programs will not run on anything less than Windows 2000. Also, if you don't have a broadband Internet connection, you're sunk. Downloads total more than a third the size of a CD image, I believe. (Don't quote that.)

I shall assume you are setting up your system to keep building junk separate from the rest of your system. I have a ~16GB hard drive, so space is *relatively* restricted for me. I keep everything together on an M: drive (4.86GB); you should be able to substitute any drive for M: as long as you can install to that drive. For simplicity I shall leave all paths as the default except for the drive letter, which I will change to M:. Some parts of the installs will only install in default locations, tho - there are a few files in "C:\Program Files\Microsoft Visual Studio .NET 2003" and friends that should really be on the M:\ drive, but there aren't very many from what I can see.

------------------------------------------------------------------------------------------------------------------------

1. Download and install the Microsoft .NET Framework Version 1.1 Redistributable Package:
<http://www.microsoft.com/downloads/details.aspx?familyid=262d25e3-f589-4842-8157-034d1e7cf3a3&displaylang=en>

NOTE: This has only one installation location. It cannot be segregated to M:.

2. Download and install the .NET Framework SDK Version 1.1:
<http://www.microsoft.com/downloads/details.aspx?FamilyId=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en>

NOTE: When installing, the SDK Samples in Install Options is not necessary. I haven't installed them because of my limited space.

3. Go to <http://www.microsoft.com/msdownload/platformsdk/sdkupdate/>

NOTE: You must use Internet Explorer for this step.

4. Select Downloads > Install from the in-page dropdown menu.

NOTE: You must use Internet Explorer for this step.

5. Select the Windows SDK checkbox. (I grabbed the Media SDK to be safe, too.) Some removal may be possible, but I have not tested anything else. (Sample code removal is almost certainly OK, but I was dumb and forgot to do this, and it takes too long to do all this as it is.)

NOTE: You must use Internet Explorer for this step.

6. Click on the Start Installation button and go to the next page.

NOTE: You must use Internet Explorer for this step.

7. Click Continue on the next page.

NOTE: You must use Internet Explorer for this step.

8. In the options dialogs, agree to the EULA and set the Install location to the M: drive if it is not already there.

NOTE: You must use Internet Explorer for this step.

9. Click Install Now on the next dialog, click OK on the security precautionary alert titled "SDK Update", and wait for the download/installation of all the SDKs to complete.

NOTE: You must use Internet Explorer for this step.

10. Close the installer and Internet Explorer.

NOTE: You must use Internet Explorer for this step. It's the last one, tho ;-).

11. Download and install the Visual C++ Toolkit 2003:
<http://www.microsoft.com/downloads/details.aspx?FamilyId=272BE09D-40BB-49FD-9CB0-4BFA122FA91B&displaylang=en>

NOTE: The only install steps necessary should be agreeing to a EULA and setting the Install location to reside on the M: drive.

12. Download and unzip the following files to M: (so that the file DLLs reside in M:\vc71\bin):
<ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/vc71-glib-1.2.10-bin.zip>
<ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/vc71-libIDL-0.6.8-bin.zip>

13. Download and install masm32v8. Unzip INSTALL.EXE from zip and run it. Select the M: drive for the installation. When a command line shows up, press any key and wait. Once the command line stuff is done, you should be back in the installer, where a click on OK ends this step:
<http://webhost.ccp.com/~win32/hutch/masm32v8.zip>

14. Download the Cygwin installer:
<http://www.cygwin.com/setup.exe>

15. Run the Cygwin installer. Set the install location to M:\cygwin, set the package location to somewhere safe, install for All Users, and set Default Text File Type to Unix. Next, find a working mirror; the list is filled with uglies, so you may have to search a while (more likely a few whiles).

16. Click on View once to get in a View All mode. Select the following packages (latest versions) if they aren't selected already, and then hit Next to start yet another monstrous download. Don't select perl, because we'll use the ActiveState Windows-based one (at no loss of features) to hopefully be able to build installer builds later:

# ash -- UNIX-like command line interpreter shell
# cvs -- get the source with this (or another way, it's not really needed)
# diffutils -- file comparison utility
# fileutils
# findutils
# gawk -- pattern matching language (Devel category)
# grep -- text search tool
# make -- dependency analyzer for software builds (Devel category)
# nano -- a simple Unix text editor (not required, but better than Notepad)
# patch -- used to apply a patch to enable building of Firefox due to errors in profile migration
# sed -- a search and replace language
# sh-utils
# textutils
# unzip -- zip file extraction (Archive category)
# zip

17. Download and install ActivePerl from ActiveState. Note that contact info isn't required. Install ActivePerl version 5.6.1 (or the latest smaller-numbered ActivePerl - 5.8.3 is broken right now, see bug 232002 and bug 232003) for Windows. You don't need to install Examples:
<http://activestate.com/Products/Download/Register.plex?id=ActivePerl>

NOTE: Perl can be installed on a drive other than C:, but I didn't notice this when I set up the environment.

18. Download and install the Netscape wintools. Unzip the file somewhere, open a command prompt, do SET MOZ_TOOL=M:\moztools, and then run install.bat inside buildtools\windows from the zip:
<http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip>

19. Press Win+Break on the keyboard to open up the System Properties applet. Click on the Advanced tab and then the Environment Variables button at the bottom.

20. Add or edit your system variables (the bottom section, not the top) to these values. Feel free to double-check that each exists for extra security. If you have extra paths already existing in any of these, it's *probably* safe to move them to the end of the list (YMMV). When done, close the dialog and its parent dialog:

Variable: Value:
PATH M:\vc71;M:\vc71\bin;M:\Program Files\Microsoft Visual C++ Toolkit 2003\bin;M:\Program Files\Microsoft SDK\bin;M:\Program Files\Microsoft.NET\SDK\v1.1\Bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;M:\moztools\bin;M:\cygwin\bin;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE;M:\Program Files\Microsoft SDK\Bin\Win64;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;M:\masm32\BIN;C:\Perl\bin
LIB M:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;M:\Program Files\Microsoft SDK\Lib;M:\Program Files\Microsoft.NET\SDK\v1.1\Lib;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib;M:\masm32\LIB;M:\Program Files\Microsoft SDK\Lib\IA64
INCLUDE M:\Program Files\Microsoft Visual C++ Toolkit 2003\include;M:\Program Files\Microsoft SDK\include;M:\Program Files\Microsoft.NET\SDK\v1.1\include;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include;M:\Program Files\Microsoft SDK\include\Win64\crt;M:\masm32\INCLUDE
GLIB_PREFIX M:\vc71
LIBIDL_PREFIX M:\vc71
MOZ_TOOLS M:\moztools
CVSROOT :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
HOME M:\mozilla

NOTE: The Wbem path may not be necessary, but I haven't tested. Building for me took three hours when I built in Linux a while back, so I can't test easily.
NOTE: You could also set these variables in a batch file if you wanted, but then you'd have to run it every time you wanted to build Firefox.

21. Create the directory M:\mozilla. Open a Windows command prompt and move to the newly created directory. Type in "cvs login", and use the password "anonymous" at the prompt (ignore any error message you may get about .cvspass not existing). Then type "cvs co mozilla/browser/config mozilla/client.mk" at the command prompt.

22. Create a .mozconfig build file. Insert the following lines in it and save. You can use "mv mozconfig.txt .mozconfig" to rename the file from mozconfig.txt if you can't create a file called ".mozconfig" in Windows (or better yet, use nano as mentioned above ;-) ):

#######################################
. $topsrcdir/browser/config/mozconfig

export BUILD_OFFICIAL=1
export MOZILLA_OFFICIAL=1
mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZILLA_OFFICIAL=1

ac_add_options --disable-debug
ac_add_options --enable-optimize
ac_add_options --disable-shared
ac_add_options --enable-static
ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
#######################################

23. Move to M:\mozilla\mozilla. Run "make -f client.mk checkout" to download the latest Firefox source from the trunk. You may want to check <http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox> to see whether the Windows tree is burning or not; if it is you almost certainly won't be able to build source.

24. Patch the source to make it build with the build tools. The patch is at <http://troop326.us/x-misc/free-build-patch.txt> for now, and you can apply the patch by moving to M:\mozilla\mozilla\browser and doing "set POSIXLY_CORRECT=1;patch -p0 < free-build-patch.txt;" (substituting the real path to the patch).

25. Run "make -f client.mk build". Wait a bit and test your new Firefox!
User avatar
TierMann
Posts: 184
Joined: March 29th, 2004, 10:18 am
Location: Sitting here, posting to fourms.
Contact:

Post by TierMann »

Nice :)

True, I didn't go into much detail. My instructions are more for someone
who has done a couple builds before and wants to change their environment.
aebrahim
Posts: 1234
Joined: November 10th, 2002, 2:47 am
Location: Hong Kong
Contact:

Post by aebrahim »

Waldo wrote:13. Download and install masm32v8. Unzip INSTALL.EXE from zip and run it. Select the M: drive for the installation. When a command line shows up, press any key and wait. Once the command line stuff is done, you should be back in the installer, where a click on OK ends this step:
<http://webhost.ccp.com/~win32/hutch/masm32v8.zip>

Why not install the latest version of MASM32 which is 8.2 from http://www.masm32.com/ ?
User avatar
Waldo
Posts: 596
Joined: July 29th, 2003, 8:21 am
Location: Cambridge, MA
Contact:

Post by Waldo »

aebrahim wrote:
Waldo wrote:13. Download and install masm32v8. Unzip INSTALL.EXE from zip and run it. Select the M: drive for the installation. When a command line shows up, press any key and wait. Once the command line stuff is done, you should be back in the installer, where a click on OK ends this step:
<http://webhost.ccp.com/~win32/hutch/masm32v8.zip>

Why not install the latest version of MASM32 which is 8.2 from http://www.masm32.com/ ?

That's one of the things I did based on info from elsewhere in the thread - I think the link was on the first page midway down, and I never bothered to correct it because I simply wanted the environment working before I worried about that sort of thing. There's certainly more like it as I mentioned at the top of the post.
nrthomas
Posts: 1988
Joined: February 9th, 2003, 3:25 pm

Post by nrthomas »

Is it still necessary to run dos2unix on the headers in m:\moztools ?
Nick Thomas - Mozilla Release Engineer
User avatar
Waldo
Posts: 596
Joined: July 29th, 2003, 8:21 am
Location: Cambridge, MA
Contact:

Post by Waldo »

CrazyFred wrote:Is it still necessary to run dos2unix on the headers in m:\moztools ?

Nope, that's only for MinGW/cygwin builds; MSVC builds don't need that, I believe. That's also only in the gcc section of the Win32 build docs, further supporting the idea.
User avatar
TierMann
Posts: 184
Joined: March 29th, 2004, 10:18 am
Location: Sitting here, posting to fourms.
Contact:

Post by TierMann »

I havn't had to with MSVC++ 2002, or the MSVC++ 2003 Toolkit.
User avatar
Waldo
Posts: 596
Joined: July 29th, 2003, 8:21 am
Location: Cambridge, MA
Contact:

Post by Waldo »

I've just gotten an error for missing the include file "atlbase.h" (because my .mozconfig doesn't have ac_add_options --disable-accessibility like yours does, TierMann). A quick search through M: shows one in M:\Program Files\Microsoft SDK\src\mfc and one in M:\Program Files\Microsoft SDK\include\Win64\atl. I'm going to put the second one in my INCLUDE and start another build (it definitely looks more trustworthy). Perhaps that one'll turn out okay. It's nice to see that the build error is actually a simple one that I can understand and fix. :-)

So, the list of changes to my instructions:
-switch MASM to the good one from the official site
-reduce software DLs at beginning if possible
-add in missing path(s?) to INCLUDE
User avatar
TierMann
Posts: 184
Joined: March 29th, 2004, 10:18 am
Location: Sitting here, posting to fourms.
Contact:

Post by TierMann »

Good discovery though.
I've always had accessibility disabled in mine.
If your path works, I'll try with it enabled on next build and add it to the path on my instructions
User avatar
Julan
Posts: 69
Joined: April 1st, 2004, 6:30 pm
Location: Australia, Mate!
Contact:

Post by Julan »

when you install the microsoft SDK, does it allow you to save the installation files or do you have to redownload it if you format?
User avatar
Waldo
Posts: 596
Joined: July 29th, 2003, 8:21 am
Location: Cambridge, MA
Contact:

Post by Waldo »

My second attempt at building failed for unknown reasons. Everything was chugging away happily until that point. Perhaps I need to find a good Linux distro and start doing all my work there where I know compiling is a piece of cake (because it basically requires a few extra RPM/packages and no other setup).
User avatar
TierMann
Posts: 184
Joined: March 29th, 2004, 10:18 am
Location: Sitting here, posting to fourms.
Contact:

Post by TierMann »

Julan wrote:when you install the microsoft SDK, does it allow you to save the installation files or do you have to redownload it if you format?


You have to redownload. It installs from an activex window.
An option would be to burn the microsoft SDK directory to a cd or backup drive.

Sorry to hear about your troubles Waldo.
I havn't had any problems in NSS before.
Wish I could help you there.


On a happier note:
I've come up with a toggle (--disable) for IE Migration.
I'll have something to post in bugzilla tomorrow.
Malakai
Posts: 172
Joined: July 15th, 2003, 3:11 pm
Location: Florida
Contact:

Post by Malakai »

Waldo wrote:
CrazyFred wrote:Is it still necessary to run dos2unix on the headers in m:\moztools ?

Nope, that's only for MinGW/cygwin builds; MSVC builds don't need that, I believe. That's also only in the gcc section of the Win32 build docs, further supporting the idea.



I believe this is incorrect. I recall the dos2unix part being in the official mozilla build instructions. cygwin is a unix environment, the included utilities are unix tools. The compiler has nothing to do with that.


EDIT:
Using the path settings suggested by TierMann, and after installing the internet technology SDK, I successfully built thunderbird using the flags:

Code: Select all

-O1 -G7 -arch:SSE
.

Now, since Waldo made that LOVELY patch file ;), I have firefox going right now. FYI the tbird build works like a charm.
Post Reply