Ubuntu系統下解決Qt5使用SSL的“qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method”錯誤

參考鏈接:https://www.cnblogs.com/btian/p/6130560.html

首先下載openssl:

git clone https://github.com/openssl/openssl.git

然後選擇1.1.0穩定版,並且編譯:

git checkout OpenSSL_1_0_0-stable
./config enable-shared
make depend
make -j4

將編譯生成的四個文件考到Qt目錄(/home/david/MySoft/Qt5.8.0/5.8/gcc_64/lib/)下面(這樣會把系統自帶的openssl也降級別,危險):

libcrypto.so libssl.so libcrypto.so.1.0.0 libssl.so.1.0.0 

應該最好在目錄 /home/david/MySoft/Qt5.8.0/5.8/ 下面新建MyOpenSSL,將libcrypto.so libssl.so libcrypto.so.1.0.0 libssl.so.1.0.0 拷貝到: /home/david/MySoft/Qt5.8.0/5.8/MyQtSSL  目錄下面。然後在Qtcreator 增加動態庫路徑(如下圖):

至於爲什麼不拷貝到 /home/david/MySoft/Qt5.8.0/5.8/gcc_64/lib/ 下面,那是因爲一般Ubuntu安裝Qt會在 .bashrc 文件下面。
export LD_LIBRARY_PATH=${LD_LIBRARY_LIB}:/home/david/MySoft/Qt5.8.0/5.8/gcc_64/lib

這樣就會影響到整個系統的PATH,系統自帶的openssl功能被覆蓋。(再次感謝參考鏈接提供的幫助)

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章