Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

This article needs a technical review. How you can help.

Introduction

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.

Build Environment

Windows

  1. 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

To get the source of a specific release, see NSS Releases.

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.

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_OPT
0
Build a debug (non-optimized) version of NSS. This is the default.
1
Build an optimized (non-debug) version of NSS.
USE_64
0
Build for a 32-bit environment/ABI. This is the default.
1
Build for a 64-bit environment/ABI.
USE_ASAN
0
Do not create an AddressSanitizer build. This is the default.
1
Create an AddressSanitizer build.

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

Unit Testing

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

Replace localhost and 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.

Document Tags and Contributors

Tags: 
 Last updated by: tschuy,