This article needs a technical review. How you can help.
This page has detailed information on how to build NSS. Because NSS is a cross-platform library that builds on many different platforms and has many options, it may be complex to build. Please read these instructions carefully before attempting to build.
- Get the Prerequisites
- NSS compilation on Windows uses the same shared build system as Mozilla Firefox. You must first install the Windows Prerequisites, including MozillaBuild.
Get the source
NSS and NSPR use Mercurial for source control like other Mozilla projects. To check out the latest sources for NSS and NSPR--which may not be part of a stable release--use the following commands:
hg clone https://hg.mozilla.org/projects/nspr hg clone https://hg.mozilla.org/projects/nss
Configure the Environment
The build system for NSS uses a variety of environment variables to control the build. Below is a list of the variables, along with possible values they may be set to. For example, on Windows, you may wish to set OS_TARGET=WIN95.
- Build for all supported versions of Windows. This is the default (as of NSS 3.15.4) and the recommend configuration.
- WINNT (obsolete)
- An alternative configuration, which is no longer supported. (It uses special features like the Windows fibers API.)
- Build a debug (non-optimized) version of NSS. This is the default.
- Build an optimized (non-debug) version of NSS.
- Build for a 32-bit environment/ABI. This is the default.
- Build for a 64-bit environment/ABI.
- Do not create an AddressSanitizer build. This is the default.
- Create an AddressSanitizer build.
To build NSS, it's as simple as navigating to the NSS checkout and making the "nss_build_all" target.
cd nss make nss_build_all
NSS contains extensive unit tests. Scripts to run these are found in the
tests directory. Run the standard suite by:
cd nss/tests HOST=localhost DOMSUF=localdomain ./all.sh
localdomain with the hostname and domain suffix for your host (the tests just turn these into "$HOST.$DOMSUF").
Test output is stored in
tests_results/security/$HOST.$NUMBER/. The file
results.html summarizes the resules,
output.log captures all the test output.
Other subdirectories of
nss/tests contain scripts that run a subset of the full suite.