我的脑袋很快就会爆炸......我想用-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。
答案 0 :(得分:5)
我必须使用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的说法:
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
答案 1 :(得分:0)
尝试./configure -no-openssl
如果您不需要用paraView与另一台计算机对话,则完全绕开openssl。