編譯環境:
- 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安裝成功。