Open Confusedr opened 4 months ago
使用编译方式安装Gmssl,可以避免第一个问题
你检查一下src/event/ngx_event_openssl.h:17:10: fatal error: openssl/des.h: No such file or directory,到底有没有头文件,另外最好po一下make install安装OCL时的日志
你检查一下src/event/ngx_event_openssl.h:17:10: fatal error: openssl/des.h: No such file or directory,到底有没有头文件,另外最好po一下make install安装OCL时的日志
root@debian:~/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/build# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/gmssl3_openssl ..
-- The C compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/build
root@debian:~/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/build# make
[ 7%] Building C object CMakeFiles/crypto.dir/src/err.c.o
[ 15%] Building C object CMakeFiles/crypto.dir/src/bio.c.o
[ 23%] Building C object CMakeFiles/crypto.dir/src/evp.c.o
/root/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/src/evp.c: In function ‘EVP_DigestInit_ex’:
/root/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/src/evp.c:46:13: warning: implicit declaration of function ‘sm3_digest_init’; did you mean ‘digest_init’? [-Wimplicit-function-declaration]
46 | if (sm3_digest_init(ctx, NULL, 0) != 1) {
| ^~~~~~~
| digest_init
/root/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/src/evp.c: In function ‘EVP_DigestUpdate’:
/root/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/src/evp.c:55:13: warning: implicit declaration of function ‘sm3_digest_update’; did you mean ‘digest_update’? [-Wimplicit-function-declaration]
55 | if (sm3_digest_update(ctx, d, cnt) != 1) {
| ^~~~~
| digest_update
/root/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/src/evp.c: In function ‘EVP_DigestFinal_ex’:
/root/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/src/evp.c:64:13: warning: implicit declaration of function ‘sm3_digest_finish’; did you mean ‘digest_finish’? [-Wimplicit-function-declaration]
64 | if (sm3_digest_finish(ctx, dgst) != 1) {
| ^~~~~
| digest_finish
[ 30%] Building C object CMakeFiles/crypto.dir/src/rand.c.o
[ 38%] Building C object CMakeFiles/crypto.dir/src/asn1.c.o
[ 46%] Building C object CMakeFiles/crypto.dir/src/x509.c.o
[ 53%] Building C object CMakeFiles/crypto.dir/src/x509_vfy.c.o
[ 61%] Building C object CMakeFiles/crypto.dir/src/crypto.c.o
[ 69%] Building C object CMakeFiles/crypto.dir/src/pem.c.o
[ 76%] Building C object CMakeFiles/crypto.dir/src/dh.c.o
[ 84%] Linking C shared library libcrypto.so
[ 84%] Built target crypto
[ 92%] Building C object CMakeFiles/ssl.dir/src/ssl.c.o
[100%] Linking C shared library libssl.so
[100%] Built target ssl
root@debian:~/workspace/GmSSL-3.1.1/OpenSSL-Compatibility-Layer-0.8.1/build# make install
[ 84%] Built target crypto
[100%] Built target ssl
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/gmssl3_openssl/lib/libcrypto.so
-- Set runtime path of "/usr/local/gmssl3_openssl/lib/libcrypto.so" to ""
-- Installing: /usr/local/gmssl3_openssl/lib/libssl.so
-- Set runtime path of "/usr/local/gmssl3_openssl/lib/libssl.so" to ""
-- Installing: /usr/local/gmssl3_openssl/include/openssl
-- Installing: /usr/local/gmssl3_openssl/include/openssl/dh.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/bio.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/hmac.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/opensslv.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/rand.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/x509.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/conf.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/x509_vfy.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/ssl.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/asn1.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/bn.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/x509v3.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/rsa.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/pem.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/err.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/symhacks.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/evp.h
-- Installing: /usr/local/gmssl3_openssl/include/openssl/crypto.h
老师好: 确实没有相关头文件,可以直接拿openssl的相关头文件么?
使用编译方式安装Gmssl,可以避免第一个问题
使用master分支编译安装后,解决了
都解决了吗
都解决了吗 只有OpenSSL-Compatibility-Layer编译报错的问题解决了,Nginx还在尝试
都解决了吗 只有OpenSSL-Compatibility-Layer编译报错的问题解决了,Nginx还在尝试
你看看这个报错和这个类似不:https://github.com/GmSSL/OpenSSL-Compatibility-Layer/issues/4 解决方法是删掉本机的libssl-dev,以免冲突
都解决了吗 只有OpenSSL-Compatibility-Layer编译报错的问题解决了,Nginx还在尝试
你看看这个报错和这个类似不:#4 解决方法是删掉本机的libssl-dev,以免冲突
非常感谢,缺失的头文件从openssl考过来就可以了,编译已经没有问题了。 但是现在遇到一个新的问题,希望指点一二,链接时,希望是静态链接,但是OPL标准编译只有动态库,如何能生成静态库?
我之前也遇到过这个问题,然后莫名其妙消失了,好像是config的时候不指定openssl的地址就行?
你按这个流程试试
删掉本机的libssl-dev,然后重新编译安装GmSSL和OCL的master版本,再从源码编译安装nginx-1.24.0
这是我在阿里云一台空白ubuntu22.04机器上从头安装的脚本,你可以参考一下
#!/bin/bash
apt-get update
apt-get install cmake git -y
rm -rf GmSSL
git clone https://github.com/guanzhi/GmSSL.git
rm -rf OpenSSL-Compatibility-Layer
git clone https://github.com/GmSSL/OpenSSL-Compatibility-Layer.git
rm -rf nginx-1.24.0.tar.gz
wget http://nginx.org/download/nginx-1.24.0.tar.gz
tar zxvf nginx-1.24.0.tar.gz
cd ./GmSSL/
mkdir build && cd build
cmake ..
make
make test
make install
cd ../../OpenSSL-Compatibility-Layer/
mkdir build && cd build
cmake ..
make
make install
ldconfig
cd ../../nginx-1.24.0/
./configure --with-http_ssl_module --with-debug --without-http_rewrite_module
make
make install
/usr/local/nginx/sbin/nginx -v
编译Nginx时,会报缺少头文件,导致Nginx无法编译通过 Nginx版本为1.24 ./configure --with-http_ssl_module --with-debug --without-http_rewrite_module --with-openssl=/usr/local/gmssl-3.1.1 --prefix=/usr/local/nginx
make
make -f objs/Makefile make[1]: Entering directory '/root/workspace/nginx/nginx' cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I src/lic -I /usr/local/gmssl-3.1.1/include -I objs \ -o objs/src/core/nginx.o \ src/core/nginx.c In file included from src/core/ngx_core.h:84, from src/core/nginx.c:9: src/event/ngx_event_openssl.h:17:10: fatal error: openssl/des.h: No such file or directory 17 | #include <openssl/des.h> | ^
~~~~~~ compilation terminated. make[1]: [objs/Makefile:380: objs/src/core/nginx.o] Error 1 make[1]: Leaving directory '/root/workspace/nginx/nginx' make: [Makefile:10: build] Error 2