Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Changes between Version 24 and Version 25 of BuildingWinNSS


Ignore:
Timestamp:
Mar 5, 2010, 1:16:45 AM (14 years ago)
Author:
John Bailey
Comment:

Some tweaks to the wiki formatting, and note incompatibilities with 64-bit NSS or Visual C++ compiled NSS and Pidgin

Legend:

Unmodified
Added
Removed
Modified
  • BuildingWinNSS

    v24 v25  
    55NSS stands for [http://www.mozilla.org/projects/security/pki/nss/ Network Security Services]. NSS is required to use SSL in Pidgin. NSS depends on NSPR and a [https://wiki.mozilla.org/NSS_Shared_DB shared database] (SQLite since [http://www.mozilla.org/projects/security/pki/nss/nss-3.12/nss-3.12-release-notes.html NSS 3.12]), but you don't have to worry about these, there's and NSS with NSPR package which is compact thus it contains all sources required to build NSS.
    66
    7 '''Note''': at the moment you can't build NSS completely using GCC. It fails at the final stage when linking additional tools. However, you can build all the important libraries successfully. It will hopefully be improved in the future. You can build NSS completely with [http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&displaylang=en#filelist Microsoft Visual C++ 2008 Express Edition SP1]. This isn't covered in this tutorial but it's basically the same. However, if you build NSS with Visual C++, you must instruct your users to install the [http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en Microsoft Visual C++ 2008 SP1 Redistributable Package] or include it in the installer of your application (if permitted).
     7'''Note''': at the moment you can't build NSS completely using GCC. It fails at the final stage when linking additional tools. However, you can build all the important libraries successfully. It will hopefully be improved in the future. You can build NSS completely with [http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&displaylang=en#filelist Microsoft Visual C++ 2008 Express Edition SP1]. This isn't covered in this tutorial but it's basically the same. However, if you build NSS with Visual C++, you must instruct your users to install the [http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en Microsoft Visual C++ 2008 SP1 Redistributable Package] or include it in the installer of your application (if permitted).  Note that you cannot use NSS with Pidgin if it is built with Visual C++, as the mingw GCC and Visual C++'s compiler link against different, incompatible C libraries.
    88
    99== Prerequisites ==
    1010
    11  1. Get NSS
    12 
    13   Download [ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_5_RTM/src/nss-3.12.5-with-nspr-4.8.2.tar.gz NSS with NSPR 3.12.5]. Extract it to `c:\devel\pidgin-devel\win32-dev`.
    14 
    15  2. Get !MozillaBuild
    16 
    17   Download [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.4.exe MozillaBuild 1.4] and install it to `c:\devel\mozilla-build`.
    18 
    19  3. Get MinGW
    20 
    21   This assumes that you have MinGW working as described in the [wiki:BuildingWinPidgin#Themanualway Pidgin Building Instructions] (in short, you need [https://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/ MinGW] installed with at least gcc).
     11 1. '''Get NSS:'''  Download [ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_5_RTM/src/nss-3.12.5-with-nspr-4.8.2.tar.gz NSS with NSPR 3.12.5]. Extract it to `c:\devel\pidgin-devel\win32-dev`.
     12 1. '''Get MozillaBuild:'''  Download [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.4.exe MozillaBuild 1.4] and install it to `c:\devel\mozilla-build`.
     13 1. '''Get MinGW''':  This assumes that you have MinGW working as described in the [wiki:BuildingWinPidgin#Themanualway Pidgin Building Instructions] (in short, you need [https://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/ MinGW] installed with at least gcc).
    2214
    2315== Choose build flavour ==
    2416
    2517The 3 most important options are:
    26 
    2718 * target OS
    2819 * optimization
     
    3021
    3122You can toggle them with environmental variables. Here's the matrix:
    32 
    33 {{{
     23   {{{
    3424#!comment
    35 ||||BUILD_OPT=0||BUILD_OPT=0||BUILD_OPT=1||BUILD_OPT=1||
    36 ||||USE_DEBUG_RTL=0||USE_DEBUG_RTL=1||USE_DEBUG_RTL=0||USE_DEBUG_RTL=1||
     25|| ||BUILD_OPT=0||BUILD_OPT=0||BUILD_OPT=1||BUILD_OPT=1||
     26|| ||USE_DEBUG_RTL=0||USE_DEBUG_RTL=1||USE_DEBUG_RTL=0||USE_DEBUG_RTL=1||
    3727||OS_TARGET=WIN95||WIN954.0_DBG.OBJ||WIN954.0_DBG.OBJD||WIN954.0_OPT.OBJ||N/A||
    3828||OS_TARGET=WINNT||WINNT6.1_DBG.OBJ||WINNT6.1_DBG.OBJD||WINNT6.1_OPT.OBJ||N/A||
    39 }}}
    40 
    41 {{{
     29   }}}
     30   {{{
    4231#!rst
    4332
     
    5140=================  =================  =================  =================  =================
    5241
    53 }}}
     42   }}}
    5443
    5544The version after WINNT is the version of your current OS (you can check it with the `winver` command). WINNT6.1 assumes you're building on Windows 7.
     
    5847
    5948Pick the desired configuration (in other words, cell), and set the environmental variables with `set`. Example:
    60 
    61 {{{
     49   {{{
    6250set BUILD_OPT=1
    6351set OS_TARGET=WIN95
    64 }}}
     52   }}}
    6553
    6654'''WARNING''': it seems the builder considers any variable as 1 if it's set. So if you enter
    67 
    68 {{{
     55   {{{
    6956set BUILD_OPT=0
    70 }}}
    71 
     57   }}}
    7258you'll get an optimized build although you wanted a debug one. The answer lies in `mozilla\security\coreconf\WIN32.mk`. They check variables with ifdefs, which is just plain wrong (or they should mention it this way in the documentation).
    7359
    7460'''Solution''': set a variable only if you want the related build. Here's the table for seeing what you actually have to enter and what you'll get:
    75 
    76 ||||||USE_DEBUG_RTL=1||BUILD_OPT=1||
    77 ||OS_TARGET=WIN95||WIN954.0_DBG.OBJ||WIN954.0_DBG.OBJD||WIN954.0_OPT.OBJ||
    78 ||OS_TARGET=WINNT||WINNT6.1_DBG.OBJ||WINNT6.1_DBG.OBJD||WINNT6.1_OPT.OBJ||
    79 
     61   || || ||USE_DEBUG_RTL=1||BUILD_OPT=1||
     62   ||OS_TARGET=WIN95||WIN954.0_DBG.OBJ||WIN954.0_DBG.OBJD||WIN954.0_OPT.OBJ||
     63   ||OS_TARGET=WINNT||WINNT6.1_DBG.OBJ||WINNT6.1_DBG.OBJD||WINNT6.1_OPT.OBJ||
    8064OS_TARGET is an exception and isn't affected by this error because it's not numerical, so the script checks for its value instead of its existence. As a sidenote, BUILD_OPT seems to have a higher priority than USE_DEBUG_RTL, so if you enter
    81 
    82 {{{
     65   {{{
    8366set BUILD_OPT=1
    8467set USE_DEBUG_RTL=1
    85 }}}
    86 
     68   }}}
    8769you'll get an optimized build without linking with the debug RTL. In case you want, for example, a debug build after an optimized, you can unset the variable by setting it without a value, such as:
    8870
    89 {{{
     71   {{{
    9072set BUILD_OPT=
    91 }}}
     73   }}}
    9274
    9375More info about the build variables can be found on the [https://developer.mozilla.org/en/NSS_reference/Building_and_installing_NSS/Build_instructions Build instructions] page of the Mozilla Developer Central.
     
    168150  * Visual C++ Compilers
    169151  * Win32 Development Tools
     152 1. Start `Microsoft Windows SDK v7.0/CMD Shell` from the Start Menu. Don't be bothered by the message about target, it won't affect this build. If it really annoys you, you can tweak it with `setenv` (query flags with `setenv /?`).
     153 1. Find a way to include `moztools\bin` and `msys\bin` in PATH.
     154 1. Set build flavour as before, and additionally add the following:
     155   {{{
     156set USE_64=1
     157   }}}
     158 1. Start compiling:
     159   {{{
     160make nss_build_all
     161   }}}
     162 1. Instruct your users to download and install the [http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ba9257ca-337f-4b40-8c14-157cfdffee4e Microsoft Visual C++ 2008 SP1 x64 Redistributable Package] or include it in the installer of your application (if permitted).
    170163
    171  2. Start `Microsoft Windows SDK v7.0/CMD Shell` from the Start Menu. Don't be bothered by the message about target, it won't affect this build. If it really annoys you, you can tweak it with `setenv` (query flags with `setenv /?`).
    172 
    173  3. Find a way to include `moztools\bin` and `msys\bin` in PATH.
    174 
    175  4. Set build flavour as before, and additionally add the following:
    176 
    177 {{{
    178 set USE_64=1
    179 }}}
    180 
    181  5. Start compiling:
    182 
    183 {{{
    184 make nss_build_all
    185 }}}
    186 
    187  6. Instruct your users to download and install the [http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ba9257ca-337f-4b40-8c14-157cfdffee4e Microsoft Visual C++ 2008 SP1 x64 Redistributable Package] or include it in the installer of your application (if permitted).
     164Note that it's not possible to use a 64-bit version of NSS with Pidgin on Windows.  Pidgin is a 32-bit application, thus cannot interact with 64-bit libraries.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!