QT enVocabulary工程打包問題記錄


我用QT自帶的工具*deployqt把工程enVocabulary在mac,windows,ubuntu上打包,出現了一些問題。
下面是一些bug記錄。

SQlite Mysql的依賴問題。

WARNING: Plugin "libqsqlodbc.dylib" uses private API and is not Mac App store compliant.
WARNING: Plugin "libqsqlpsql.dylib" uses private API and is not Mac App store compliant.
ERROR: no file at "/opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib"
ERROR: no file at "/usr/local/lib/libpq.5.dylib"

聽說這是QT自身的bug,使用了SQlite則會需要用到Mysql的庫文件,不用管。
直接macdeployqt走起。

QML程序打包問題

運行程序,窗體含有QML的部分是空白的。

module "QtQuick.Window" is not installed
module "QtQuick.Controls" is not installed
module "QtQuick" is not installed
...

搜尋后,發現系統的QML路徑是/Users/weiyang/Qt5.9.2/5.9.2/clang_64/qml
打包后已經有framework:./enVocabulary.app/Contents/Frameworks/QtQuick.framework
那是怎么回事兒?
在文件夾中搜尋qml文件:

weiyangdeMacBook-Air:enVocabulary weiyang$ find enVocabulary.app/ -name *qml
weiyangdeMacBook-Air:enVocabulary weiyang$ 

居然沒有qml文件!
在stack overflow上找到相關的問題:https://stackoverflow.com/questions/17475788/qt-5-1-and-mac-bug-making-macdeployqt-not-working-properly/28221423#28221423
原來在使用macdeployqt打包的時候需要指定qml文件的地址。
也即:macdeployqt enVocabulary.app/ -qmldir=/Users/weiyang/code/enVocabulary -dmg
然后在enVocabulary.app//Contents/Resources/qml/ 就能看到各種qml, qmlc文件了
之后,編譯運行,一切正常!

No rule to make target

類似於這樣的報錯:

mingw32-make[1]: *** No rule to make target '../enVocabulary/image/res.rc', needed by 'OBJ/res_res.o'.  Stop.

不一定是Makefile的問題,很有可能是根本沒有文件../enVocabulary/image/res.rc(名字寫錯了)

qt.network.ssl: QSslSocket: cannot resolve

我的程序使用了network相關的類,然后運行報錯:

qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
...
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_server_method
qt.network.ssl: QSslSocket: cannot resolve X509_STORE_CTX_get_chain
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve SSLeay
qt.network.ssl: QSslSocket: cannot resolve SSLeay_version

當前的QT版本是5.9.2,我用代碼打印SSL相關的信息:

qDebug()<<"SSL version use for build: "<<QSslSocket::sslLibraryBuildVersionString();
qDebug()<<"SSL version use for run-time: "<<QSslSocket::sslLibraryVersionString();
qDebug()<<QSslSocket::supportsSsl()<<endl;
qDebug()<<QCoreApplication::libraryPaths();

結果:

SSL version use for build:  "OpenSSL 1.0.1e-fips 11 Feb 2013"
qt.network.ssl: Incompatible version of OpenSSL
SSL version use for run-time:  ""
false 

在stack overflow上一頓查詢,什么重新下載openssl再編譯,QT組件修復等方法都嘗試了一遍,沒用。

然后逛qt官網,希望最新版本的QT能解決這個問題。http://blog.qt.io/blog/2017/12/07/qt-5-10-released/
果然讓我找到了相關的信息:




下載Qt5.10.1,安裝后重新運行:

SSL version use for build:  "OpenSSL 1.0.2k-fips 26 Jan 2017"
SSL version use for run-time:  "OpenSSL 1.0.2g 1 Mar 2016"
true 

但我在后面的log(考慮到容錯性,我加了許多的DEBUG)中發現了新的問題:The issuer certificate of a locally looked up certificate could not be found
這是為什么?我在terminal中啟動openssl,然后它提示找不到庫文件,我將libcrypto.so, libssl.so相關的四個文件全部放進/usr/lib中,然后可以正常啟動了。

parallels@parallels-vm:~/Downloads/openssl-1.1.1-pre4$ openssl version
OpenSSL 1.1.1-pre4 (beta) 3 Apr 2018

但是Qt運行報錯:

SSL version use for build:  "OpenSSL 1.0.2k-fips 26 Jan 2017"
...
qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
qt.network.ssl: QSslSocket: cannot resolve SSLeay
qt.network.ssl: Incompatible version of OpenSSL
...
qt.network.ssl: Incompatible version of OpenSSL
SSL version use for run-time:  ""   SSL version use for run-time: 
false 

版本不兼容,好煩。。。
參照之前的log,我下載了openssl 1.0.2g:https://www.openssl.org/source/old/1.0.2/
編譯,安裝,然后創建軟連接:ln -s /home/parallels/Downloads/openssl-1.0.2g/apps/openssl /usr/local/bin/openssl
但是版本不兼容的錯誤仍然存在!回想自己是將libcrypto.so, libssl.so相關的四個文件全部放進/usr/lib中然后就出現了兼容性問題。我又將/usr/lib路徑下的*crypto.so*,*ssl.so*的四個文件統統刪除了。
然后運行,perfect!


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
  © 2014-2022 ITdaan.com 联系我们: