gpt4 book ai didi

qt - 使用OpenSSL链接编译Qt5时出错

转载 作者:行者123 更新时间:2023-12-03 22:22:55 34 4
gpt4 key购买 nike

我的头很快就会爆炸...我想用-openssl-linked编译qt,以便将openssl库链接到qt库中。我已经尝试了许多选项,并且编译时的输出始终是:

ssl/qsslcertificate_openssl.cpp: In function ‘uint qHash(const QSslCertificate&, uint)’:
ssl/qsslcertificate_openssl.cpp:63:30: error: invalid use of incomplete type ‘X509 {aka struct x509_st}’
return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed);
^
In file included from /usr/local/include/openssl/crypto.h:131:0,
from /usr/local/include/openssl/comp.h:59,
from /usr/local/include/openssl/ssl.h:148,
from ../../include/QtNetwork/5.5.1/QtNetwork/private/../../../../../src/network/ssl/qsslcontext_openssl_p.h:53,
from ../../include/QtNetwork/5.5.1/QtNetwork/private/qsslcontext_openssl_p.h:1,
from ssl/qsslsocket_p.h:55,
from ssl/qsslsocket_openssl_p.h:63,
from ssl/qsslsocket_openssl_symbols_p.h:64,
from ssl/qsslcertificate_openssl.cpp:35:
/usr/local/include/openssl/ossl_typ.h:160:16: note: forward declaration of ‘X509 {aka struct x509_st}’
typedef struct x509_st X509;

我编译了openssl并尝试通过我的编译库来编译qt:
OPENSSL_LIBS='-L/opt/openssl_build/lib -lssl -lcrypto' ./configure -prefix /opt/qt5.5.1_linux_staticssl -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl -no-opengl -no-libpng -no-pulseaudio -no-linuxfb -no-gif -no-gstreamer -no-gtkstyle -no-directfb -no-gui -no-eglfs -no-glib -I /opt/openssl_build/include/openssl -L /opt/openssl_build/lib -no-xcb

我知道错误似乎是在加载旧的openssl库,但是我已经尝试过更改该路径,以便找不到它并强制其加载新的。
我不知道该怎么办Qt版本是5.5.1 openssl 1.0.1和g++ 5.2。

最佳答案

我必须使用openssl版本1.0.1构建Qt,不知道它是否可以与1.0.2一起使用。我必须更改系统的openssl库的路径,以便Qt被迫使用我制作的库。
在源代码目录运行的汇编openssl的行:

./config --prefix=/opt/openssl_build_stable -shared
make
make test
sudo make install

我对Qt的conf行:
OPENSSL_LIBS='-L/opt/openssl_build_stable/lib -lssl -lcrypto' ./configure -prefix /opt/qt5.5.1_linux_staticssl -opensource -confirm-license -release -nomake examples -nomake tests -static -openssl-linked -I /opt/openssl_build_stable/include/openssl -L /opt/openssl_build_stable/lib

感谢simon-warta

关于qt - 使用OpenSSL链接编译Qt5时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35488166/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com