@torresdyl
2016-11-17T21:03:08.000000Z
字数 4242
阅读 4258
未分类
(In some environments we have NSS+NSPR installed, such as in my RedHat 7.2, I have:
Installed Packages
nss.x86_64 3.21.0-17.el7 @rhel-7-server-rpms
and:
Installed Packages
nspr.x86_64 4.11.0-1.el7_2 @rhel-7-server-eus-rpms
so we can see that NSS 3.21 + NSPR 4.11 is stable. At least I think so.)
You can check with sudo yum list nss*
, and to get more info about every nss-related package, use sudo yum info nss*
. NSPR is alike, sudo yum list nspr*
.
If you want to upgrade them, use sudo yum upgrade nss*
, or check-update
. If they are not working, just sudo yum install nss*
, sudo yum install nspr*
.
From the main page of NSS, we can enter the Release link to find all versions:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Releases
Here we choose NSS 3.27, and the link indicates that NSS 3.27 is working with NSPR 4.13:
https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_27_RTM/src/
So we download them all.
To unzip a .tar.gz
file, we use:
tar -xvzf your_zipped_file
If is a .tar
file, use:
tar -xvf your_compressed_file
About how to use tar
and what these arguments mean, there's a good answer in AskUbuntu:
http://askubuntu.com/questions/25347/what-command-do-i-need-to-unzip-extract-a-tar-gz-file
Type man tar for more information, but this command should do the trick:
tar -xvzf community_images.tar.gz
To explain a little further,
tar
collected all the files into one package,community_images.tar
. Thegzip
program applied compression, hence thegz
extension. So the command does a couple things:
f
: this must be the last flag of the command, and the tar file must be immediately after. It tellstar
the name and path of the compressed file.z
: tellstar
to decompress the archive usinggzip
x
:tar
can collect files or extract them.x
does the latter.v
: makestar
talk a lot. Verbose output shows you all the files being extracted.
Now, you see two directories, nss
and nspr
. Enter nss
, and with instructions of NSS building in Mozilla.org,
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Sources_Building_Testing
you must build with these command:
gmake nss_build_all
If gmake
is not available, try to install build-essential
or gcc
with g++
. If still missing, make
can do it.
As per the previous building instruction, there're two arguments that deserve our attention:
In order to start the build process, use "cd nss" and execute "make nss_build_all". By default this will produce a build in debug mode and for a 32-bit architecture. You may set the environment variable
BUILD_OPT=1
to get an optimized build, and/or variableUSE_64=1
to get a 64-bit build.
If you have seen this error:
ssl3con.c:36:18: fatal error: zlib.h: No such file or directory
#include "zlib.h"
^
compilation terminated.
You must add this argument: NSS_SSL_ENABLE_ZLIB=
If you encounter this error:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h:No such file or directory
Be sure to add USE_64=1
and try to install glibc-devel
.
If you still see a similar but different error, like this:
gcc -o Linux3.10_x86_64_cc_glibc_PTH_64_OPT.OBJ/zip.o -c -O2 -fPIC -DLINUX2_1 -m64 -pipe -ffunction-sections -fdata-sections -DLINUX -Dlinux -DHAVE_STRERROR -Wall -Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I../../../dist/Linux3.10_x86_64_cc_glibc_PTH_64_OPT.OBJ/include -I../../../dist/public/nss -I../../../dist/private/nss -I../../../dist/public/seccmd zip.c
zip.c:7:18: fatal error: zlib.h: No such file or directory
#include "zlib.h"
^
compilation terminated.
You can solve it like this:
- If you are using Ubuntu x32, try to install zlib1g-dev
.
- If you are using Redhat x64, try to install zlib-devel
.
And build with all the arguments necessary.
After successful building, you can see no errors are promptted, and you can see a dist
directory on the same level of nss
and nspr
. Like this:
|
- dist
- nss
- nspr
The installation guide of Mozilla is simple but not so clear:
Searching with "install nss" will lead you to this site, where we find more information:
http://www.linuxfromscratch.org/blfs/view/svn/postlfs/nss.html
Note the title of this site is "NSS-3.27.1", meaning that it's updated till now (nov. 2016).
If you have NSS and NSPR installed previously, you may have to check where are they preinstalled. Like in my case, run a locate libnss3.so
gives me that it's in /usr/lib64
. So try not to cause conflict.
It's always good to check where each and every file are installed. To check them in RPM-based environment, use
rpm -ql some_package
And in dpkg-based system, use
dpkg -L package_name
to list all files owned by this package.