On 10/17/07, D3||||!$ <e.kaba...
> I am new to SSL programming: currently trying to "play" with it... :-)
> I'm having some problems with compiling the sample client-server
> source code given on the Mozilla/NSS official site.
> I went through the code but found that it has been written using the
> NSPR source files. I had both, the NSS+NSPR source package as well as
> the binaries of the same. To make the things "idiot-proof", I put all
> the .C/.CPP/.hs in a single large include folder and then including
> it. I also included the libs, dlls & chks contained in the lib folder
> of the NSS binaries package. I finally ended up with some 40+ linker
> errors in the both, client_test.obj & server_test.obj & sslsamples.obj
> files. This makes me suspect that I've not/erroneously included some
> of the files necessary for compilation...
> Could you please tell me which files are required for the proper
> compilation of the project?
> Also, if you could tell me which files are required to be included for
> developing SSl applications(since before initializing NSS, NSPR has to
> be iniatilized..), I'll be extremely glad.
> Another thing which I wanted to enquire was that some of the files
> were .C while others were .CPP so what should I compile the source as:
> as C code or as CPP code?
You should compile the source as C code.
NSPR and NSS use GNU makefiles. The build instructions
for NSS (including building NSPR) are at
The most difficult part is to install the prerequisite GNU make and
Unix utilities on your Windows machine. Fortunately Ben Smedberg's
"MozillaBuild" package makes this real easy:
So install MozillaBuild and run the start-msvc8.bat batch file.
It'll start up a command shell running "bash". In bash, the
command to set an environment variable "FOO" to 1 is
There is an alternative: use our binary distributions:
They were built using VC++ 6.0, but should work with VC++ 2005.
Even if you don't use the binary distributions, they still provide
a piece of useful information -- they only include the headers
and libraries that you need to develop an SSL app with NSS/NSPR.
You can also get this info from the build tree.
NSPR headers you need are in mozilla/dist/WIN954.0_OPT.OBJ/include,
except all the headers in mozilla/dist/WIN954.0_OPT.OBJ/include/md and
the header mozilla/dist/WIN954.0_OPT.OBJ/include/private/primpl.h.
NSS headers you need are in mozilla/dist/public/nss
The libraries you need:
Import libraries: nspr4.lib, plc4.lib, plds4.lib, nss3.lib, smime3.lib, ssl3.lib
DLLs: nspr4.dll, plc4.dll, plds4.dll, nss3.dll, softokn3.dll,
softokn3.chk, freebl3.dll, freebl3.chk, smime3.dll, ssl3.dll
Note: the binary data files softokn3.chk and freebl3.chk are
needed for using NSS in the FIPS mode.