编译环境:
- wsl ubuntu 20.04
由于GmSSL继承自openssl, 为了防止和openssl冲突,最好将GmsSL 编译为静态库 在Linux下安装GmSSL
1、 执行 ./config --prefix=/usr/local/gmssl --openssldir=/usr/local/gmssl no-shared
将其安装到/usr/local/gmssl.
注:–prefix表示安装路径;no-shared 表示只编译静态库;默认生成64位库。
执行后报错信息:
Operating system: x86_64-whatever-linux2
"glob" is not exported by the File::Glob module
Can't continue after import errors at ./Configure line 18.
BEGIN failed--compilation aborted at ./Configure line 18.
"glob" is not exported by the File::Glob module
Can't continue after import errors at ./Configure line 18.
BEGIN failed--compilation aborted at ./Configure line 18.
This system (linux-x86_64) is not supported. See file INSTALL for details
这是由于Perl package导致,修改Configure文件. 参考链接
use if $^O ne "VMS", 'File::Glob' => qw/glob/;
修改为
use if $^O ne "VMS", 'File::Glob' => qw/:glob/;
2、 再次执行报错
Something wrong with this line:
Program fragment delivered error ``"glob" is not exported by the File::Glob module
at /mnt/e/secure/GmSSL-master/test/build.info at ./Configure line 1644.
原因同上,修改 test/build.info中, 查找File::Glob. 修改后即可生成makefile
3、执行 make -j8
报错信息:
make depend && make _tests
make[1]: Entering directory '/mnt/e/secure/GmSSL-master'
make[1]: Leaving directory '/mnt/e/secure/GmSSL-master'
make[1]: Entering directory '/mnt/e/secure/GmSSL-master'
( cd test; \
SRCTOP=../. \
BLDTOP=../. \
PERL="/usr/bin/perl" \
EXE_EXT= \
OPENSSL_ENGINES=.././engines \
OPENSSL_DEBUG_MEMORY=on \
/usr/bin/perl .././test/run_tests.pl )
"glob" is not exported by the File::Glob module
Can't continue after import errors at .././test/run_tests.pl line 19.
BEGIN failed--compilation aborted at .././test/run_tests.pl line 19.
make[1]: *** [Makefile:153: _tests] Error 255
make[1]: Leaving directory '/mnt/e/secure/GmSSL-master'
make: *** [Makefile:150: tests] Error 2
按以上方法修改run_tests.pl即可。
4、执行sudo make install
安装
5、查看是否成功 执行 gmssl version
至此,GmSSL安装成功。