[tor-dev] Building Tor Browser Bundle on Windows

Tom Ritter tom at ritter.vg
Mon Mar 4 03:31:04 UTC 2013


This weekend I tried building several of the tor projects on Windows (tor, vidalia, tbb, and vanilla firefox).  I kept notes of my adventures, some of the quirks I ran into, and the final set of instructions that seemed to work for me.

Perhaps most usefully, I've created an Amazon AMI that anyone will be able to boot up and use.  (Yes, this has trust issues, I've addressed them in the top of the README document attached.)  The intention is that people who want to test a patch or develop a patch can use this to bootstrap themselves, without having to fight long and hard to set up a Windows build environment.

I've attached two documents:
 1) TBB Environment README.txt
 2) Adventures in Compilation.txt
 
The first is the README for the environment.
The second is a journal of my trying to figure out what to do.  Specifically I'm going to call out several issues.  If desired, I can submit patches to address them, and they can be reviewed.

I understand that documentation is usually a lower priority than actually shipping software, please take these comments not as bitchy criticism, but instead a list of things I'd like to improve, if someone can review my suggestions and shepard me a little.

1) Firefox's official build environment is VS2010 while TBB's is VS2008

I'm not 100% sure, but it seems like it'd be relatively easy to switch TBB over to 2010.  There may be some issues.  But it seems like it'd be good to track FF's official build env.  I ran across at least 1 Vanilla FF issue that broke in 2008, and there seemed to be a few in the bugtracker.

2) Vidalia's build environment instructions contradict TBB's

https://gitweb.torproject.org/vidalia.git/blob/HEAD:/INSTALL
https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/docs/buildmachine_setups/windows.txt

Vidalia's says you need CMake in your PATH, TBB's says you don't.  
I think it can be in your PATH.

3) There's no explicit instructions on how to build Tor in Windows

It seems like you just build it in MinGW?  It worked anyway.
It's a (minor) bitch to get the components built and placed in the 'correct way 
and place' for the MinGW toolchain.  (Now documented in my README)

4) The TorBrowser build instructions are really, really bad.

https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/docs/buildmachine_setups/windows.txt
This is pretty good.  But it just ends abruptly, and doesn't tell you want to do.

https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/docs/HACKING
This document seems to be mostly up to date, although I think the FF Extensions
it lists have been changed since.

https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/build-scripts/INSTALL
This one is super out of date.
 - You don't need subversion or winrar
 - It talks a lot about getting FirefoxPortable (or built a custom Firefox)
 - I didn't try following the instructions for MinGW, msys, cmake, qt, msysGTK, 
   or autoconf - since I had those already.  It seems these sections have been 
   subsumed by the windows buildmachine document
 - The OpenSSL instructions do not match the instructions IN OpenSSL
 - Vidalia's links are way out of date and dead
 - Its instructions for Vidalia don't match Vidalia's
 - It talks about PidginPortable?  I think that's been nixed...
 - "Currently the Tor Browser Bundle uses FirefoxPortable binaries."
 - It talks about building with MSVC 7.1 (Visual Studio 2003)
 - It stops short of telling you how to actually build the bundle, probably 
   because the makefiles are newer than this document
   
https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/build-scripts/DEPLOYMENT
This doesn't seem applicable at all anymore

I eventually found (by searching my email spools) the magic incantation to kick it off.  The "TorBrowser" section of Adventures in Compilation.txt shows my hiccups and luck getting it going.



Finally, after all this.... tbb-firefox crashes. I don't know why.  I don't know if it's because I'm using VS2010, or my msvc*.dll swaps.  Specifically it's crashing here:

c:\build\torbrowser\build-scripts\build-alpha-windows\build\firefox-17.0.3esr\content\xul\templates\src\nsrulenetwork.h
    class Iterator : public ConstIterator {
        public:
            Iterator(ReteNode** aNode) : ConstIterator(aNode) {}

            Iterator& operator++() {
                ++mCurrent;
                return *this; }

            Iterator operator++(int) {
                Iterator result(*this);
                ++mCurrent;
                return result; }

            ReteNode* operator*() const {
                return *mCurrent; }   <=========================================

            ReteNode* operator->() const {
                return *mCurrent; }

            bool operator==(const ConstIterator& aConstIterator) const {
                return mCurrent == aConstIterator.mCurrent; }

            bool operator!=(const ConstIterator& aConstIterator) const {
                return mCurrent != aConstIterator.mCurrent; }
        };
        
I'm not quite sure where to start figuring out *why* it's dereferencing a null ptr.  The windbg output is in the bottom of both docs.

The AMI for the EC2 instance is ami-2e36ab47 - when you start it, open ports 3389 and 8080 in the firewall for 0.0.0.0/0 (or just your IP address if you want.)
If you try it, and get skeeved out by them asking for your SSH private key to get the password, check out https://github.com/tomrittervg/decrypt-windows-ec2-passwd

-tom
-------------- next part --------------
================================================================================
A Word On Trust
================================================================================

If you're properly paranoid you should get the heeby jeebies working in someone
else's computer.  You don't want to trust anythig on here.

You shouldn't.

But if you use it properly, you shouldn't *have* to.  I don't *intend* for you 
to.  Write your patches, test them, and then submit the *patch* for review.

Don't do something silly like building a release from this AMI, or producing a 
test version for someone.  

See also, the section "Running the Webserver"

================================================================================
Filesystem
================================================================================

C:\
    build\
        libevent-2.0.21-stable\
            See section "Building libevent"
        openssl-1.0.0k\
            See section "Building openssl"
        zlib-1.2.7\
            See section "Building zlib"
        tor
            A git checkout of https://git.torproject.org/tor.git
            See section "Building Tor"
        vidalia
            A git checkout of https://git.torproject.org/vidalia.git
            See section "Building Vidalia"
        torbrowser
            A git checkout of https://git.torproject.org/torbrowser.git
            See section "Building TorBrowser"
    mozilla-build
        An extraction of https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe
        From 03/02/2012, Version 1.6.1
    mozilla-central
        A checkout of https://hg.mozilla.org/mozilla-central
        See section "Building Firefox"
    webserver
        See section "Running the Webserver"
    
================================================================================
Environment
================================================================================

 - MinGW mingw-get-inst-20120426
 - CMake 2.8.10.2
 - MsysGit 1.8.0
 - QT 4.8.1
 - Windows SDK for Windows 7 and .Net Framework 4
 - DirectX Jun10 SDK
 - nasm 2.10.07
 
 - Visual Studio C++ Express 2010          < NOT 2008!
 - ActiveState ActivePerl
 
 - Process Monitor
 - Process Explorer
 - Notepad++
 - Chrome
 - 7-Zip
 
 - mongoose webserver
 
PATH:
    C:\Perl\site\bin;
    C:\Perl\bin;
    %SystemRoot%\system32;
    %SystemRoot%;
    %SystemRoot%\System32\Wbem;
    %systemroot%\System32\WindowsPowerShell\v1.0\;
    C:\Program Files (x86)\Git\cmd;
    C:\Program Files\Microsoft Windows Performance Toolkit\;
    C:\Program Files (x86)\CMake 2.8\bin;
    C:\Qt\4.8.1\bin;
    C:\Program Files (x86)\nasm;
    C:\MinGW\bin
 
================================================================================
Environment Non-Standardness
================================================================================

1) MinGW dll Issue

Trying to build vidalia, I got an error with MinGW that's explained here:
   http://mingw-users.1079350.n2.nabble.com/Question-libgmp-10-dll-not-found-td7443661.html
I solve it by following their advice, and copying the 6 affected dlls into 
the affected directory:

  libgmp-10.dll       
  libmpc-2.dll        
  libmpfr-1.dll       
  libgcc_s_dw2-1.dll 
  libiconv-2.dll     
  libintl-8.dll      
 to C:\MinGW\libexec\gcc\mingw32\4.6.2
 
2) TBB Build Script Changes for VS2010

See section "Building TorBrowser"
 
================================================================================
Running the Webserver
================================================================================

Having a computer like this that you don't trust presents a conundrum: if you 
want to copy a file off, how do you do it without typing in a password or 
copying over an SSH key?  I've tried to address this issue.

mongoose is the dumbest, dead-simplest webserver I could find for Windows.

1) Go to C:\webserver  - there is a single exe
2) Run it, and it will stick an icon in your task tray. 
3) It's now serving that directory (C:\webserver) on port 8080
4) If you need to download anything off the machine, put it in this directory,
     hit its IP, and download it.

================================================================================
Building libevent
================================================================================

Using a MinGW shell, ./configure and make worked without errors

================================================================================
Building zlib
================================================================================

Using a MinGW shell, the below worked without errors

    Administrator at AMAZONA-DCN4MGA /c/build/zlib-1.2.7
    $ make -f win32/Makefile.gcc

================================================================================
Building openssl
================================================================================

There are two ways to build OpenSSL: 
 - As a Windows DLL
 - As a MinGW toolchain library (needed for Tor)

--------------------------------------------------------------------------------
Windows DLL:
--------------------------------------------------------------------------------
OpenSSL uses batch scripts that call perl, so you must have perl in your PATH.

Follow C:\build\openssl-1.0.0k\INSTALL.W32 

This consisted of, for me, from a command prompt:

1) perl Configure VC-WIN32 --prefix=C:\build\openssl-1.0.0k

2) To keep it simple and omit the assembly language instructions:
    perl Configure VC-WIN32 no-asm --prefix=C:\build\openssl-1.0.0k
    ms\do_ms

2) To include assembly:
    ms\do_nasm
    
3) Open up the Visual Studio Command Prompt
    nmake -f ms\ntdll.mak
    
I've successfully build both the ASM and non-ASM versions.  
You may need to issue 'nmake -f ms\ntdll.mak clean'


--------------------------------------------------------------------------------
MinGW Toolchain:
--------------------------------------------------------------------------------

Open a MinGW Prompt

0) cd /c/build/openssl-1.0.0k
1) make clean
2) perl Configure mingw no-shared no-asm --prefix=/c/build/openssl-1.0.0k
3) make depend
4) make
   It failed for me inside the test/ directory
5) Rename test to tmp-test
6) make
7) Rename tmp-test to test
   Ifyou don't do this, sometimes the perl configure command will fail


================================================================================
Building Vidalia
================================================================================

Following https://gitweb.torproject.org/vidalia.git/blob/HEAD:/INSTALL

Open a command prompt

0) cd C:\build\vidalia
1) mkdir build
2) cd build
3) cmake -G "MinGW Makefiles" ..
4) mingw32-make

Now you'll have a vidalia.exe in C:\build\vidalia\build\src\vidalia
 but it won't run yet, because all its dependencies need to be collected

5) mkdir output
   cd output
6) copy ..\src\vidalia\vidalia.exe
   copy "C:\MinGW\bin\libstdc++-6.dll"

At this point it will pick up the rest of the files from your PATH, but to 
     be complete
     
7) copy C:\Qt\4.8.1\bin\QTXML.dll
   copy C:\Qt\4.8.1\bin\QTNetwork4.dll
   copy C:\Qt\4.8.1\bin\QTGUI4.dll
   copy C:\Qt\4.8.1\bin\QTCore4.dll
   copy C:\Qt\4.8.1\bin\mingwm10.dll

================================================================================
Building Tor
================================================================================

Tor is a bit tricky, since from what I was able to find, it only builds using
MinGW.  This means it's dependencies need the MinGW-type libaries.

>From a MinGW Shell

0) Build libevent
1) In /c/build/libevent do a 'make install'

2) Build zlib
3) Copy zlib files to places Tor expects:
    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a libz.dll.a /mingw/lib
    
4) Build OpenSSL
5) In /c/build/openssl do a 'make install'

Now we're ready for Tor:

6) ./autogen.sh
7) ./configure --with-openssl-dir=/c/build/openssl-1.0.0k/ --disable-asciidoc

Disabling asciidoc will tell it not to complain because we don't have it 
installed.

8) make

================================================================================
Building Firefox
================================================================================

Following, https://developer.mozilla.org/en-US/docs/Simple_Firefox_build

0) Open up start-msvc10.bat
1) cd /c/mozilla-central
2) ./mach build
3) Wait at least 45 minutes
   (On a m3.2xlarge it takes at least 45 minutes)

================================================================================
Building TorBrowser
================================================================================

So TorBrowser is pretty self-contained with its dependencies, but at the same 
time, it expects MSVC 2008, and we've got 2010.

>From a MinGW prompt,

0) cd /c/build/torbrowser/build-scripts
1) Open C:\build\torbrowser\build-scripts\windows.mk
2) Edit
  
  - Change MSVC_VER to 10
  - Adjust NUM_CORES to your liking
  - Find the line 
        cp "/c/Program Files (x86)/Microsoft Visual Studio 9.0/VC/redist/x86/Microsoft.VC90.CRT/"msvc*90.dll $(FIREFOX)/App/Firefox
    Comment it, and add a replacement underneath it:
        cp "/c/Windows/SysWOW64/"msvc*100.dll $(FIREFOX)/App/Firefox
  - Below it there is a line:
        cp -r $(FIREFOX_DIR)/obj-*/dist/firefox/* $(FIREFOX)/App/Firefox
    Comment it, and add a replacement underneath it:
        cp -r $(FIREFOX_DIR)/dist/bin/* $(FIREFOX)/App/Firefox
        
3) make -f windows.mk build-all-binaries bundle 

TBB will now crash.  

Running tbb-firefox.exe in windbg shows


    Microsoft (R) Windows Debugger Version 6.12.0002.633 AMD64
    Copyright (c) Microsoft Corporation. All rights reserved.

    CommandLine: "C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\tbb-firefox.exe"
    Symbol search path is: *** Invalid ***
    ****************************************************************************
    * Symbol loading may be unreliable without a symbol search path.           *
    * Use .symfix to have the debugger choose a symbol path.                   *
    * After setting your symbol path, use .reload to refresh symbol locations. *
    ****************************************************************************
    Executable search path is: 
    ModLoad: 00000000`00370000 00000000`003ab000   firefox.exe
    ModLoad: 00000000`773c0000 00000000`77569000   ntdll.dll
    ModLoad: 00000000`775a0000 00000000`77720000   ntdll32.dll
    ModLoad: 00000000`743b0000 00000000`743ef000   C:\Windows\SYSTEM32\wow64.dll
    ModLoad: 00000000`74350000 00000000`743ac000   C:\Windows\SYSTEM32\wow64win.dll
    ModLoad: 00000000`74420000 00000000`74428000   C:\Windows\SYSTEM32\wow64cpu.dll
    (7a4.cb4): Break instruction exception - code 80000003 (first chance)
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll - 
    ntdll!CsrSetPriorityClass+0x40:
    00000000`7746cb60 cc              int     3
    0:000> g
    ModLoad: 00000000`77140000 00000000`7725f000   WOW64_IMAGE_SECTION
    ModLoad: 00000000`74ce0000 00000000`74df0000   WOW64_IMAGE_SECTION
    ModLoad: 00000000`77140000 00000000`7725f000   NOT_AN_IMAGE
    ModLoad: 00000000`76e30000 00000000`76f2a000   NOT_AN_IMAGE
    ModLoad: 00000000`74ce0000 00000000`74df0000   C:\Windows\syswow64\kernel32.dll
    ModLoad: 00000000`751f0000 00000000`75237000   C:\Windows\syswow64\KERNELBASE.dll
    ModLoad: 00000000`76200000 00000000`76300000   C:\Windows\syswow64\USER32.dll
    ModLoad: 00000000`76350000 00000000`763e0000   C:\Windows\syswow64\GDI32.dll
    ModLoad: 00000000`76a50000 00000000`76a5a000   C:\Windows\syswow64\LPK.dll
    ModLoad: 00000000`74df0000 00000000`74e8d000   C:\Windows\syswow64\USP10.dll
    ModLoad: 00000000`764d0000 00000000`7657c000   C:\Windows\syswow64\msvcrt.dll
    ModLoad: 00000000`753a0000 00000000`75440000   C:\Windows\syswow64\ADVAPI32.dll
    ModLoad: 00000000`76860000 00000000`76879000   C:\Windows\SysWOW64\sechost.dll
    ModLoad: 00000000`76960000 00000000`76a50000   C:\Windows\syswow64\RPCRT4.dll
    ModLoad: 00000000`74c80000 00000000`74ce0000   C:\Windows\syswow64\SspiCli.dll
    ModLoad: 00000000`74c70000 00000000`74c7c000   C:\Windows\syswow64\CRYPTBASE.dll
    ModLoad: 00000000`737d0000 00000000`7388e000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\MSVCR100.dll
    (7a4.cb4): WOW64 breakpoint - code 4000001f (first chance)
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll32.dll - 
    ntdll32!LdrVerifyImageMatchesChecksum+0x96c:
    77640fab cc              int     3
    0:000:x86> g
    ModLoad: 76a60000 76ac0000   C:\Windows\SysWOW64\IMM32.DLL
    ModLoad: 76bb0000 76c7c000   C:\Windows\syswow64\MSCTF.dll
    ModLoad: 730d0000 73116000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\nspr4.dll
    ModLoad: 73ca0000 73ca7000   C:\Windows\SysWOW64\WSOCK32.dll
    ModLoad: 75450000 75485000   C:\Windows\syswow64\WS2_32.dll
    ModLoad: 76850000 76856000   C:\Windows\syswow64\NSI.dll
    ModLoad: 73090000 730c2000   C:\Windows\SysWOW64\WINMM.dll
    ModLoad: 73950000 73971000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozglue.dll
    ModLoad: 724a0000 72775000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozjs.dll
    ModLoad: 76af0000 76af5000   C:\Windows\syswow64\PSAPI.DLL
    ModLoad: 73020000 73089000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\MSVCP100.dll
    ModLoad: 73ce0000 73ceb000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\plc4.dll
    ModLoad: 73c80000 73c8b000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\plds4.dll
    ModLoad: 73000000 73018000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\nssutil3.dll
    ModLoad: 72f60000 72ffe000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\nss3.dll
    ModLoad: 72f40000 72f58000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\smime3.dll
    ModLoad: 72f10000 72f35000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\ssl3.dll
    ModLoad: 72e70000 72f08000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozsqlite3.dll
    ModLoad: 73c70000 73c76000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozalloc.dll
    ModLoad: 700a0000 7046e000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\gkmedias.dll
    ModLoad: 74410000 74415000   C:\Windows\SysWOW64\MSIMG32.dll
    ModLoad: 6ea80000 7009f000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\xul.dll
    ModLoad: 75490000 760da000   C:\Windows\syswow64\SHELL32.dll
    ModLoad: 76470000 764c7000   C:\Windows\syswow64\SHLWAPI.dll
    ModLoad: 75240000 7539c000   C:\Windows\syswow64\ole32.dll
    ModLoad: 74400000 74409000   C:\Windows\SysWOW64\VERSION.dll
    ModLoad: 72e50000 72e6c000   C:\Windows\SysWOW64\IPHLPAPI.DLL
    ModLoad: 73b90000 73b97000   C:\Windows\SysWOW64\WINNSI.DLL
    ModLoad: 74030000 740b0000   C:\Windows\SysWOW64\UxTheme.dll
    ModLoad: 75050000 751ed000   C:\Windows\syswow64\SETUPAPI.dll
    ModLoad: 76ac0000 76ae7000   C:\Windows\syswow64\CFGMGR32.dll
    ModLoad: 763e0000 7646f000   C:\Windows\syswow64\OLEAUT32.dll
    ModLoad: 76910000 76922000   C:\Windows\syswow64\DEVOBJ.dll
    ModLoad: 72e30000 72e47000   C:\Windows\SysWOW64\USERENV.dll
    ModLoad: 73b00000 73b0b000   C:\Windows\SysWOW64\profapi.dll
    ModLoad: 72e10000 72e23000   C:\Windows\SysWOW64\dwmapi.dll
    ModLoad: 737c0000 737c8000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\xpcom.dll
    ModLoad: 00000000`72200000 00000000`7230b000   C:\Windows\SysWOW64\dwrite.dll
    ModLoad: 00000000`741b0000 00000000`7434e000   C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll
    ModLoad: 00000000`76880000 00000000`76903000   C:\Windows\syswow64\CLBCatQ.DLL
    ModLoad: 00000000`740b0000 00000000`741a5000   C:\Windows\SysWOW64\propsys.dll
    Could not read chrome manifest 'jar:file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/omni.ja!/chrome.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/en-US.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/toolkit.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/pippki.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/browser.manifest'.
    ModLoad: 73bb0000 73bec000   C:\Windows\SysWOW64\mswsock.dll
    ModLoad: 72e00000 72e05000   C:\Windows\SysWOW64\wshtcpip.dll
    ModLoad: 72450000 7249b000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\components\browsercomps.dll
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/pdfjs.manifest'.
    (7a4.cb4): Access violation - code c0000005 (first chance)
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    *** WARNING: Unable to verify checksum for C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\xul.dll
    xul!ReteNodeSet::Iterator::operator*+0xa:
    6f3d73ca 8b08            mov     ecx,dword ptr [eax]  ds:002b:00000000=????????

And it crashing here:

c:\build\torbrowser\build-scripts\build-alpha-windows\build\firefox-17.0.3esr\content\xul\templates\src\nsrulenetwork.h
    class Iterator : public ConstIterator {
        public:
            Iterator(ReteNode** aNode) : ConstIterator(aNode) {}

            Iterator& operator++() {
                ++mCurrent;
                return *this; }

            Iterator operator++(int) {
                Iterator result(*this);
                ++mCurrent;
                return result; }

            ReteNode* operator*() const {
                return *mCurrent; }   <=========================================

            ReteNode* operator->() const {
                return *mCurrent; }

            bool operator==(const ConstIterator& aConstIterator) const {
                return mCurrent == aConstIterator.mCurrent; }

            bool operator!=(const ConstIterator& aConstIterator) const {
                return mCurrent != aConstIterator.mCurrent; }
        };
-------------- next part --------------
I knew from https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/build-scripts/INSTALL that I would need a lot of components, so I started hunting for those and making them build.

I went and got zlib 1.2.7 but it didn't have a Windows project.  1.2.4 did, I got that and confirmed it would build.  

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

Then I went to openssl.  I tried the following:
    Administrator at AMAZONA-1JR8AG3 /c/build/openssl-1.0.0k
    $ ms/mingw32.bat shared
    ms/mingw32.bat: line 1: @rem: command not found
    ms/mingw32.bat: line 2: @rem: command not found
    target already defined - mingw (offending arg: %1)
    ms/mingw32.bat: line 6: @echo: command not found
    ms/mingw32.bat: line 91: syntax error: unexpected end of file

After googling, I found to look in the INSTALL.WIN32 file.  I glanced at INSTALL.W64 but decided to keep things simple.
then in mingw:

    Administrator at AMAZONA-1JR8AG3 /c/build/openssl-1.0.0k
    $ perl Configure VC-WIN32 --prefix=C:\build\openssl-1.0.0k
    ...
    Administrator at AMAZONA-1JR8AG3 /c/build/openssl-1.0.0k
    $ perl Configure VC-WIN32 no-asm --prefix=C:\build\openssl-1.0.0k
    ...

That last step is to disable assemblyy instructions that require nasm.  Again, keeping it simple.

Then I tried to build:
    Administrator at AMAZONA-1JR8AG3 /c/build/openssl-1.0.0k
    $ ms/do_ms.bat
    Can't open perl script "utilmkfiles.pl": No such file or directory
    Can't open perl script "utilmk1mf.pl": No such file or directory
    Can't open perl script "utilmk1mf.pl": No such file or directory
    ms/do_ms.bat: line 12: syntax error: unexpected end of file
And in visual studio command prompt:
    C:\build\openssl-1.0.0k>ms\do_ms.bat

    C:\build\openssl-1.0.0k>perl util\mkfiles.pl  1>MINFO
    'perl' is not recognized as an internal or external command,
    operable program or batch file.

    C:\build\openssl-1.0.0k>perl util\mk1mf.pl no-asm VC-WIN32  1>ms\nt.mak
    'perl' is not recognized as an internal or external command,
    operable program or batch file.

    C:\build\openssl-1.0.0k>perl util\mk1mf.pl dll no-asm VC-WIN32  1>ms\ntdll.mak
    'perl' is not recognized as an internal or external command,
    operable program or batch file.

    C:\build\openssl-1.0.0k>if x == x goto skipce

    C:\build\openssl-1.0.0k>perl util\mkdef.pl 32 libeay  1>ms\libeay32.def
    'perl' is not recognized as an internal or external command,
    operable program or batch file.

    C:\build\openssl-1.0.0k>perl util\mkdef.pl 32 ssleay  1>ms\ssleay32.def
    'perl' is not recognized as an internal or external command,
    operable program or batch file.
    
At this point I was kind of frustrated, so I made a folder C:\MinGW\mingwbin and copied (COPIED, NOT MOVED) perl.exe and all .dlls from C:\MinGW\msys\1.0\bin into there, and added my new folder to my PATH variable.  (In Control Panel -> System -> Advanced)

Then ms/do_ms.bat from the command prompt worked.  Or at least it didn't give me errors.

So I ran, like it tells you, from the VS Command Prompt:
    C:\build\openssl-1.0.0k>nmake -f ms\ntdll.mak
    
Then completed immediately with no real output.  I don't think it worked...

At this point I don't think the perl commands I copied into my path actually worked.

I run the perl commands from ms/do_ms in mingw manually and confirm my path trick failed horribly.  (I undo it)

I run nmake again, but it dies, because it needs perl in the windows command prompt too. 
I give up and install ActivePerl.  (I get the x86 version)

Now when I run nmake i get a ton of output, it takes a little bit, and I wind up with... a bunch of seemingly correct looking files in the out32dll directory like I'm supposed to.  I declare a success.

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

Now I decide I'm going to tackle the beast: Firefox.

I head to https://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites?redirectlocale=en-US&redirectslug=Windows_Build_Prerequisites and get the MozillaBuild package, installing it to the default location.

That finishes.  

Since https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/docs/buildmachine_setups/windows.txt said use VS C++ 2008, I launch start-msvc9.bat

Then I head over to https://developer.mozilla.org/en-US/docs/Simple_Firefox_build#Get_the_source

I get the source, and I decide I *am* going to create a debug build, so I add in "ac_add_options --enable-debug" to .mozconfig as instructed.

Then I do the './mach build' command and settle in for what I assume is going to be a long-ass time.

40 minutes later, it stops scrolling and says somethign terimated successfully...

    40:51.81 c:\mozilla-source\mozilla-central\config\makefiles\target_libs.mk:18:0: command 'c:/mozilla-build/python/python.exe c:/mozilla-source/mozilla-central/build/pymake/pymake/../make.py -C netwerk libs' failed, return code 2
    40:51.82 c:\mozilla-source\mozilla-central\config\rules.mk:654:0: command 'c:/mozilla-build/python/python.exe c:/mozilla-source/mozilla-central/build/pymake/pymake/../make.py libs_tier_platform' failed, return code 2
    40:51.82 c:\mozilla-source\mozilla-central\config\rules.mk:619:0: command 'c:/mozilla-build/python/python.exe c:/mozilla-source/mozilla-central/build/pymake/pymake/../make.py  tier_platform' failed, return code 2
    40:51.82 c:\mozilla-source\mozilla-central\client.mk:361:0: command 'c:/mozilla-build/python/python.exe c:/mozilla-source/mozilla-central/build/pymake/pymake/../make.py -j2 -C obj-i686-pc-mingw32' failed, return code 2
    40:51.82 c:\mozilla-source\mozilla-central\client.mk:160:0: command 'c:/mozilla-build/python/python.exe c:/mozilla-source/mozilla-central/build/pymake/pymake/../make.py -f c:/mozilla-source/mozilla-central/client.mk realbuild' failed, return code 2
    Single process terminated successfully
    40:51.95 302 compiler warnings present.
    Finished building. Built files are in obj-i686-pc-mingw32
    
I went into irc, I was told to look harder, after another mach build, I saw

    obj-i686-pc-mingw32\dist\include\harfbuzz\hb-common.h(56) : error C2371: 'int8_t' : redefinition; different basic types
    
Looking at the source, these definitions are there's a comment about VS2010.  I ask in irc, and I'm told he thinks there's a bug with vs2008 not building.
I can't actually find one that mentions this particular problem.  I decide to change the macro so it will include stdint.h and send it off again.
If I get stuck, I'll consider uninstalling 2008 and getting 2010.

Well, the macro change didn't work, so I'm trying the hackey patch that's included in the bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=847078

=======================================================
=======================================================
=======================================================
At this point I was really out of disk space, so I shut down to resize the disk... and Amazon fucking killed the instance.
I went to bed, and decided to resume tomorrow.

=======================================================
=======================================================
========================
Round 2

 - This time I install VS2010
 - I get OpenSSL built quickly
 - I kick off the FF build (42 minutes later it finished successfully)
 
=======================================================
Vidalia

I look at the build instructions here:
https://gitweb.torproject.org/vidalia.git/blob/HEAD:/INSTALL

I open a mingw shell and continue

Number 1 contradicts https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/docs/buildmachine_setups/windows.txt, which says cmake does not need to be in the path.

    1. Make sure the following directories are in your PATH environment
    variable:
        
          * CMake (e.g., "C:\Program Files\CMake 2.4\bin")
          * MinGW (e.g., "C:\MinGW\bin")
          * Qt    (e.g., "C:\Qt\4.3.2\bin")

I ignore this and continue...
          
    2. Configure Vidalia and generate Makefiles by running: 

          mkdir build && cd build
          cmake -G "MinGW Makefiles" ..

       There should be no spaces in the path to your build directory. Otherwise,
       Vidalia will fail to build.
       
I do this and get

    Administrator at AMAZONA-DCN4MGA /c/build/vidalia/build
    $ cmake -G "MinGW Makefiles"
    CMake Error: The source directory "C:/build/vidalia/build" does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
    
So I ignore it, and go up a directory, and rerun the command

    Administrator at AMAZONA-DCN4MGA /c/build/vidalia
    $ cmake -G "MinGW Makefiles"
    -- Configuring Vidalia 0.2.21
    CMake Error at C:/MinGW/msys/1.0/share/cmake-2.8/Modules/CMakeMinGWFindMake.cmak
    e:20 (message):
      sh.exe was found in your PATH, here:

      C:/MinGW/msys/1.0/bin/sh.exe

      For MinGW make to work correctly sh.exe must NOT be in your path.

      Run cmake from a shell that does not have sh.exe in your PATH.

      If you want to use a UNIX shell, then use MSYS Makefiles.

    Call Stack (most recent call first):
      CMakeLists.txt:19 (project)


    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_C_COMPILER_ENV_VAR
    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_C_COMPILER
    CMake Error: Could not find cmake module file:C:/build/vidalia/CMakeFiles/2.8.10.2/CMakeCCompiler.cmake
    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_CXX_COMPILER_ENV_VAR
    CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
    Missing variable is:
    CMAKE_CXX_COMPILER
    CMake Error: Could not find cmake module file:C:/build/vidalia/CMakeFiles/2.8.10.2/CMakeCXXCompiler.cmake
    CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!

It's complaining about sh.exe in my path... I am confused.

I uninstall cmake, and reinstall it to the default location, installing it to my path this time.

This time I open a vanilla command prompt and retry:

I get the same error about CMakeLists.txt not being in build, I go up a dir and run again

I get an error about missing libgmp-10.dll
I hypothesize that I wrecked my mingw installation by uninstalling cmake. 
I redownload and install, but it completes instantly (suspicious) and doesn't fix the problem.
Running gcc --version from the mingw command line does not give errors, and libgmp-10.dll is in C:\mingw\bin

Reading http://mingw-users.1079350.n2.nabble.com/Question-libgmp-10-dll-not-found-td7443661.html I decide to copy the 6 dlls into the affected direcoty.

I get further:

    -- Configuring incomplete, errors occurred!

    C:\build\vidalia>cmake -G "MinGW Makefiles"
    -- Configuring Vidalia 0.2.21
    -- The C compiler identification is GNU 4.6.2
    -- The CXX compiler identification is GNU 4.6.2
    -- Check for working C compiler: C:/MinGW/bin/gcc.exe
    -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: C:/MinGW/bin/g++.exe
    -- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Could NOT find Qt4 (missing:  QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_LIBRARY) (Required is at least version "4.3.0")
    CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
      Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE
      QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR
      QT_QTCORE_LIBRARY) (Required is at least version "4.3.0")
    Call Stack (most recent call first):
      C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
      C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindQt4.cmake:1223 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
      CMakeLists.txt:37 (find_package)

I go add QT bin to the path, and right about now is when I notice that the cmake command has a .. at the end to look in the above directory.  I feel stupid, reopen command prompt, go into the build directory and reissue the command.

    C:\build\vidalia\build>cmake -G "MinGW Makefiles" ..
    -- Configuring Vidalia 0.2.21
    -- Looking for Q_WS_X11
    -- Looking for Q_WS_X11 - not found
    -- Looking for Q_WS_WIN
    -- Looking for Q_WS_WIN - found
    -- Looking for Q_WS_QWS
    -- Looking for Q_WS_QWS - not found
    -- Looking for Q_WS_MAC
    -- Looking for Q_WS_MAC - not found
    -- Found Qt4: C:/Qt/4.8.1/bin/qmake.exe (found suitable version "4.8.1", minimum
     required is "4.3.0")
    CMake Error at cmake/VidaliaMacros.cmake:40 (message):
      Vidalia could not find windres.  Please make sure MinGW is installed and
      its bin directory is in your PATH environment variable.
    Call Stack (most recent call first):
      CMakeLists.txt:47 (include)


    -- Configuring incomplete, errors occurred!
    
I open a MinGW prompt, and reissue, and it seems to work.

    Administrator at AMAZONA-DCN4MGA /c/build/vidalia/build
    $ cmake -G "MinGW Makefiles" ..
    -- Configuring Vidalia 0.2.21
    -- Looking for WiX
    -- Looking for WiX - not found.
    -- Looking for limits.h
    -- Looking for limits.h - found
    -- Looking for sys/limits.h
    -- Looking for sys/limits.h - not found
    -- Looking for signal.h
    -- Looking for signal.h - found
    -- Looking for sys/types.h
    -- Looking for sys/types.h - found
    -- Looking for stdint.h
    -- Looking for stdint.h - found
    -- Looking for stddef.h
    -- Looking for stddef.h - found
    -- Check size of int
    -- Check size of int - done
    -- Looking for sigaction
    -- Looking for sigaction - not found
    -- Looking for signal
    -- Looking for signal - found
    -- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
    -- Skipping vidalia-bundle.nsi.in
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/build/vidalia
    
I cd .. and mingw32-make

At 17%, generating vidalia_ar.qm:
    "The program can't start because QTCore.dll is missing from your computer"
    
I think I haven't reopened mingw shell since updating my path, so I close, reopen, and reissue, and it continues...

It builds!  I try running it (src/vidalia/vidalia.exe), and it says 
    "The program can't start because libgcc_s_dw2-1.dll is missing from your computer"
    
I go get DependencyWalker, it tells me that a bunch of dlls it needs are in QT/4.x/bin which I go, retrieve and copy into a seperate folder, along with the exe.
But both DependencyWalker and Vidalia tell me it needs libstdc++-6.dll and DWalker tells me it doesn't know where it is.
I have a hunch it's in the mingw/bin folder, and I'm right.
Now it tells me it needs mingwm10.dll, which I also copy over, and it starts!  Success.


=======================================================
Tor

I clone, and hunt around for a win32 reference.  Can't find one.  
./configure doesn't work, which it says in https://gitweb.torproject.org/tor.git/blob/HEAD:/README

I try autogen.sh in a mingw prompt

it seems to do something, and then I do configure, which also does stuff
But it bails on libevent.  So I pause Tor...

=======================================================
libevent

Using a mingw shell, configure and make work completely.

=======================================================
Tor

Okay, back to Tor:
    Administrator at AMAZONA-DCN4MGA /c/build/tor
    $ ./configure --with-libevent-dir=C:\build\libevent-2.0.21-stable
    
Doesn't work, nor $ ./configure --with-libevent-dir=C:\build\libevent-2.0.21-stable\.libs

I try
    Administrator at AMAZONA-DCN4MGA /c/build/tor
    $ ./configure --with-libevent-dir=/c/build/libevent-2.0.21-stable
    
No dice. But .libs gets me closer!

    checking for libevent directory... configure: WARNING: We found the libraries for libevent, but we could not find the C header files.  You may need to install a devel package.
    configure: error: Missing headers; unable to proceed.

I copy the three dlls in the .libs folder up a dir, and retry (without the .libs)
It fails, can't find the linkable libevent.

I go back into libevent with mingw and do a 'make install'
Then I go back to Tor and do a normal configure.

Now it passes libevent but bails, same issue, on openssl.  
I know where the dlls are, but what about the header files? =/
Reading some documentation tells me the include files are in openssl/inc32 and they are.
I create a new directory, vombined32 and put the contents of out32dll and inc32 there.

    Administrator at AMAZONA-DCN4MGA /c/build/tor
    $ ./configure --with-openssl-dir=/c/build/openssl-1.0.0k/combined32/
   
It does not work. I decide I'm going to do the same thing libevent did:
 - I copy all the .dlls (and pdbs) to C:\MinGW\msys\1.0\local\bin
 - I copy the openssl cinlude folder to C:\MinGW\msys\1.0\local\include
 - There are no .a to copy to C:\MinGW\msys\1.0\local\lib

I rerun a bare ./configure
It does not work.  I copy the .libs to C:\MinGW\msys\1.0\local\lib
It does not work.
I read some more openssl documentation.
I open up the VS Command Prompt and run nmake -f ms\ntdll.mak install, which copies some stuff around in the openssl dir, then try
    $ ./configure --with-openssl-dir=/c/build/openssl-1.0.0k/
But it still don't work.
I undo the copying into C:\MinGW\msys\1.0\local\

Reading http://stackoverflow.com/questions/9379363/how-to-build-openssl-with-mingw-in-windows it seems that I can't use the openssl stuff I built using VS's compiler win mingw.

So, time to retry building openssl in mingw.  
 - make clean
 - perl Configure mingw no-shared no-asm --prefix=/c/build/openssl-1.0.0k
 - make depend
 - make
 - the tests directory failed, so i renamed it to tmp-test
 - make install
 
Now I do
    $ ./configure --with-openssl-dir=/c/build/openssl-1.0.0k/

And it works!  Now it's stuck on zlib.

Now I know I can't use the zlib 1.2.4 I built with VS, so I'll get 1.2.7 compiling in mingw

    Administrator at AMAZONA-DCN4MGA /c/build/zlib-1.2.7
    $ make -f win32/Makefile.gcc
    
This seems to work.

    Administrator at AMAZONA-DCN4MGA /c/build/tor
    $ ./configure --with-openssl-dir=/c/build/openssl-1.0.0k/ --with-zlib-dir=/c/build/zlib-1.2.7/
    
The continues, but then I get a popup
    conftest.exe: The program can't start because zlib1.dll is missing from your computer
    
Now zlib1.dll is definetly in that directory.
I copy the files:
    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a libz.dll.a /mingw/lib
And rerun ./configure --with-openssl-dir=/c/build/openssl-1.0.0k/
And it succeeds!  So I 'make'

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

    You need asciidoc installed to be able to build the manpage.
    To build without manpages, use the --disable-asciidoc argument
    when calling configure.

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

So I go back to configure and disable asciidoc.
'make' doesn't really do anything. So I make clean and then make

Now it tells me it made tor.exe!  Succes.



=======================================================
TorBrowser

I clone https://git.torproject.org/torbrowser.git

Now what do I do...
 - I already followed https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/docs/buildmachine_setups/windows.txt
 - I know https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/build-scripts/INSTALL is super out of date (FirefoxPortable?)
 - https://gitweb.torproject.org/torbrowser.git/blob/HEAD:/build-scripts/DEPLOYMENT seems to be the best reference, but I know it's going to be a bit messy, since it references an out of date doc (INSTALL)
 
$ cd build-scripts
$ make reallyclean
No rule to make target ...

windows.mk and windows-alpha.mk both reference Firefox Portable, still.  I'm increasingly confused.

I'm going to read commits for a bit, and see if that gives me direction.

It seems like the windows-alpha.mk and windows.mk build scripts are being updated.

Through sheer luck, I find a reference to "tbb-build for Windows", which I pull up in my mail archives, and find some intructions.
I try "make -f windows.mk build-all-binaries bundle" which starts some stuff.

It dies in OpenSSL

    cd /c/build/torbrowser/build-scripts/build-alpha-windows && tar -xmf openssl-1.0.0k.tar.gz -C /c/build/torbrowser/build-scripts/build-alpha-windows/build/
    tar: openssl-1.0.0k/test/srptest.c: Cannot create symlink to `../crypto/srp/srptest.c': No such file or directory
    tar: openssl-1.0.0k/test/fips_test_suite.c: Cannot create symlink to `../fips/fips_test_suite.c': No such file or directory

I issue the same "make -f windows.mk build-all-binaries bundle" command again, and it seems to continue!

It jams along for a while right up until it compains about VS2008 not being found.  Damn.  

Maybe I can get it working with 2010?
I look through windows.mk for what it needs, it seems to want some redist files that aren't in 2010 (no C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist folder).  These seem to be C++ runtime files. 
I download and run the 2008 C++ runtime (https://www.microsoft.com/en-us/Download/details.aspx?id=5582) but it gives me options to repair or uninstall. (I repair, no dice) 

I look in c:\windows\sysWoW64 and there's some msvc*100.dll files.  Maybe they'll work?
I edit windows.mk, but now it dies:

    cp "/c/Windows/SysWOW64/"msvc*100.dll /c/build/torbrowser/build-scripts/build-alpha-windows/build/FirefoxPortable-17.0.3esr/App/Firefox
    cp -r /c/build/torbrowser/build-scripts/build-alpha-windows/build/firefox-17.0.3esr/obj-*/dist/firefox/* /c/build/torbrowser/build-scripts/build-alpha-windows/build/FirefoxPortable-17.0.3esr/App/Firefox
    cp: cannot stat `/c/build/torbrowser/build-scripts/build-alpha-windows/build/firefox-17.0.3esr/obj-*/dist/firefox/*': No such file or directory
    make: *** [copy-firefox] Error 1

   
I realize that the build_firefox task never completed, and actually bombed out earlier, so I update MSC_VER in windows.mk and run the full make again.  It bombs out, launching a command prompt for the mozilla build env, and then telling me it can't copy the firefox binaries.  (Duh - it hasn't built them).

I guess that this is normal, and that it launches the command prompt to have you build firefox yourself.

I change directory to C:\build\torbrowser\build-scripts\build-alpha-windows\build\firefox-17.0.3esr and see that mozconfig doesn't have a dot in front of it.  I rename it, and then trigger the ./mach build


    Administrator at AMAZONA-DCN4MGA /c/build/torbrowser/build-scripts/build-alpha-windows/build/firefox-17.0.3esr
    $ ./mach build
    bash: ./mach: No such file or directory
    
Well shit.
I take a guess and ./configure which seems to do a bunch of stuff.
And then I do 'make'

This firefox build process is taking much much longer.  I don't think it's using all the CPUs =(

It finally finishes.  There is no obj- directory.  Well shit.
In dist/bin there is a firefox.exe though.

Hm.

I guess I'll just edit the windows.mk file to ignore that bit... (I remove the 'obj-*' subdirectory in the cp command, and fix it to firefox-17.0.3esr\dist\bin)

I got back and issue another

    Administrator at AMAZONA-DCN4MGA /c/build/torbrowser/build-scripts
    $ make -f windows.mk  build-all-binaries bundle
    
It completes shortly thereafter and I wonder... am I done? time to go hunt for this thing...

I find and copy the directory elsewhere and try to run it.

Vidalia comes up and connects to Tor, which reports that I've connected to the network.  
And then TorBrowser crashes.
    Problem signature:
      Problem Event Name:	APPCRASH
      Application Name:	tbb-firefox.exe
      Application Version:	17.0.3.4810
      Application Timestamp:	5133d68e
      Fault Module Name:	xul.dll
      Fault Module Version:	17.0.3.4810
      Fault Module Timestamp:	5133d641
      Exception Code:	c0000005
      Exception Offset:	009573ca
      OS Version:	6.1.7601.2.1.0.400.8
      Locale ID:	1033
      Additional Information 1:	0a9e
      Additional Information 2:	0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:	0a9e
      Additional Information 4:	0a9e372d3b4ad19135b953a78882e789

Running tbb-firefox.exe in windbg shows


    Microsoft (R) Windows Debugger Version 6.12.0002.633 AMD64
    Copyright (c) Microsoft Corporation. All rights reserved.

    CommandLine: "C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\tbb-firefox.exe"
    Symbol search path is: *** Invalid ***
    ****************************************************************************
    * Symbol loading may be unreliable without a symbol search path.           *
    * Use .symfix to have the debugger choose a symbol path.                   *
    * After setting your symbol path, use .reload to refresh symbol locations. *
    ****************************************************************************
    Executable search path is: 
    ModLoad: 00000000`00370000 00000000`003ab000   firefox.exe
    ModLoad: 00000000`773c0000 00000000`77569000   ntdll.dll
    ModLoad: 00000000`775a0000 00000000`77720000   ntdll32.dll
    ModLoad: 00000000`743b0000 00000000`743ef000   C:\Windows\SYSTEM32\wow64.dll
    ModLoad: 00000000`74350000 00000000`743ac000   C:\Windows\SYSTEM32\wow64win.dll
    ModLoad: 00000000`74420000 00000000`74428000   C:\Windows\SYSTEM32\wow64cpu.dll
    (7a4.cb4): Break instruction exception - code 80000003 (first chance)
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll - 
    ntdll!CsrSetPriorityClass+0x40:
    00000000`7746cb60 cc              int     3
    0:000> g
    ModLoad: 00000000`77140000 00000000`7725f000   WOW64_IMAGE_SECTION
    ModLoad: 00000000`74ce0000 00000000`74df0000   WOW64_IMAGE_SECTION
    ModLoad: 00000000`77140000 00000000`7725f000   NOT_AN_IMAGE
    ModLoad: 00000000`76e30000 00000000`76f2a000   NOT_AN_IMAGE
    ModLoad: 00000000`74ce0000 00000000`74df0000   C:\Windows\syswow64\kernel32.dll
    ModLoad: 00000000`751f0000 00000000`75237000   C:\Windows\syswow64\KERNELBASE.dll
    ModLoad: 00000000`76200000 00000000`76300000   C:\Windows\syswow64\USER32.dll
    ModLoad: 00000000`76350000 00000000`763e0000   C:\Windows\syswow64\GDI32.dll
    ModLoad: 00000000`76a50000 00000000`76a5a000   C:\Windows\syswow64\LPK.dll
    ModLoad: 00000000`74df0000 00000000`74e8d000   C:\Windows\syswow64\USP10.dll
    ModLoad: 00000000`764d0000 00000000`7657c000   C:\Windows\syswow64\msvcrt.dll
    ModLoad: 00000000`753a0000 00000000`75440000   C:\Windows\syswow64\ADVAPI32.dll
    ModLoad: 00000000`76860000 00000000`76879000   C:\Windows\SysWOW64\sechost.dll
    ModLoad: 00000000`76960000 00000000`76a50000   C:\Windows\syswow64\RPCRT4.dll
    ModLoad: 00000000`74c80000 00000000`74ce0000   C:\Windows\syswow64\SspiCli.dll
    ModLoad: 00000000`74c70000 00000000`74c7c000   C:\Windows\syswow64\CRYPTBASE.dll
    ModLoad: 00000000`737d0000 00000000`7388e000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\MSVCR100.dll
    (7a4.cb4): WOW64 breakpoint - code 4000001f (first chance)
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll32.dll - 
    ntdll32!LdrVerifyImageMatchesChecksum+0x96c:
    77640fab cc              int     3
    0:000:x86> g
    ModLoad: 76a60000 76ac0000   C:\Windows\SysWOW64\IMM32.DLL
    ModLoad: 76bb0000 76c7c000   C:\Windows\syswow64\MSCTF.dll
    ModLoad: 730d0000 73116000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\nspr4.dll
    ModLoad: 73ca0000 73ca7000   C:\Windows\SysWOW64\WSOCK32.dll
    ModLoad: 75450000 75485000   C:\Windows\syswow64\WS2_32.dll
    ModLoad: 76850000 76856000   C:\Windows\syswow64\NSI.dll
    ModLoad: 73090000 730c2000   C:\Windows\SysWOW64\WINMM.dll
    ModLoad: 73950000 73971000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozglue.dll
    ModLoad: 724a0000 72775000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozjs.dll
    ModLoad: 76af0000 76af5000   C:\Windows\syswow64\PSAPI.DLL
    ModLoad: 73020000 73089000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\MSVCP100.dll
    ModLoad: 73ce0000 73ceb000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\plc4.dll
    ModLoad: 73c80000 73c8b000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\plds4.dll
    ModLoad: 73000000 73018000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\nssutil3.dll
    ModLoad: 72f60000 72ffe000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\nss3.dll
    ModLoad: 72f40000 72f58000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\smime3.dll
    ModLoad: 72f10000 72f35000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\ssl3.dll
    ModLoad: 72e70000 72f08000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozsqlite3.dll
    ModLoad: 73c70000 73c76000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\mozalloc.dll
    ModLoad: 700a0000 7046e000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\gkmedias.dll
    ModLoad: 74410000 74415000   C:\Windows\SysWOW64\MSIMG32.dll
    ModLoad: 6ea80000 7009f000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\xul.dll
    ModLoad: 75490000 760da000   C:\Windows\syswow64\SHELL32.dll
    ModLoad: 76470000 764c7000   C:\Windows\syswow64\SHLWAPI.dll
    ModLoad: 75240000 7539c000   C:\Windows\syswow64\ole32.dll
    ModLoad: 74400000 74409000   C:\Windows\SysWOW64\VERSION.dll
    ModLoad: 72e50000 72e6c000   C:\Windows\SysWOW64\IPHLPAPI.DLL
    ModLoad: 73b90000 73b97000   C:\Windows\SysWOW64\WINNSI.DLL
    ModLoad: 74030000 740b0000   C:\Windows\SysWOW64\UxTheme.dll
    ModLoad: 75050000 751ed000   C:\Windows\syswow64\SETUPAPI.dll
    ModLoad: 76ac0000 76ae7000   C:\Windows\syswow64\CFGMGR32.dll
    ModLoad: 763e0000 7646f000   C:\Windows\syswow64\OLEAUT32.dll
    ModLoad: 76910000 76922000   C:\Windows\syswow64\DEVOBJ.dll
    ModLoad: 72e30000 72e47000   C:\Windows\SysWOW64\USERENV.dll
    ModLoad: 73b00000 73b0b000   C:\Windows\SysWOW64\profapi.dll
    ModLoad: 72e10000 72e23000   C:\Windows\SysWOW64\dwmapi.dll
    ModLoad: 737c0000 737c8000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\xpcom.dll
    ModLoad: 00000000`72200000 00000000`7230b000   C:\Windows\SysWOW64\dwrite.dll
    ModLoad: 00000000`741b0000 00000000`7434e000   C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll
    ModLoad: 00000000`76880000 00000000`76903000   C:\Windows\syswow64\CLBCatQ.DLL
    ModLoad: 00000000`740b0000 00000000`741a5000   C:\Windows\SysWOW64\propsys.dll
    Could not read chrome manifest 'jar:file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/omni.ja!/chrome.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/en-US.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/toolkit.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/pippki.manifest'.
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/browser.manifest'.
    ModLoad: 73bb0000 73bec000   C:\Windows\SysWOW64\mswsock.dll
    ModLoad: 72e00000 72e05000   C:\Windows\SysWOW64\wshtcpip.dll
    ModLoad: 72450000 7249b000   C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\components\browsercomps.dll
    Could not read chrome manifest 'file:///C:/build/torbrowser/build-scripts/Tor%20Browser_en-US/Tor%20Browser/FirefoxPortable/App/Firefox/chrome/pdfjs.manifest'.
    (7a4.cb4): Access violation - code c0000005 (first chance)
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    *** WARNING: Unable to verify checksum for C:\build\torbrowser\build-scripts\Tor Browser_en-US\Tor Browser\FirefoxPortable\App\Firefox\xul.dll
    xul!ReteNodeSet::Iterator::operator*+0xa:
    6f3d73ca 8b08            mov     ecx,dword ptr [eax]  ds:002b:00000000=????????

And it crashing here:

c:\build\torbrowser\build-scripts\build-alpha-windows\build\firefox-17.0.3esr\content\xul\templates\src\nsrulenetwork.h
    class Iterator : public ConstIterator {
        public:
            Iterator(ReteNode** aNode) : ConstIterator(aNode) {}

            Iterator& operator++() {
                ++mCurrent;
                return *this; }

            Iterator operator++(int) {
                Iterator result(*this);
                ++mCurrent;
                return result; }

            ReteNode* operator*() const {
                return *mCurrent; }   <=========================================

            ReteNode* operator->() const {
                return *mCurrent; }

            bool operator==(const ConstIterator& aConstIterator) const {
                return mCurrent == aConstIterator.mCurrent; }

            bool operator!=(const ConstIterator& aConstIterator) const {
                return mCurrent != aConstIterator.mCurrent; }
        };


More information about the tor-dev mailing list