Linux下編譯安裝WizNote
阿新 • • 發佈:2018-12-30
#(一) 下載WizNote的原始碼
建立目錄
cd ~
mkdir wizhi
##安裝git工具
# ubuntu/debian
apt-get install git -t
# rhel/centos/fedora
yum install git -y
# opensuse
zypper in git -y
下載原始碼
git clone https://github.com/WizTeam/WizQTClient.git
下載比較慢耐心等待
#(二) Linux下編譯為知雲筆記
##安裝QT
wget http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
xhost +
su - root
# 輸入您的root passwd
./qt-opensource-linux-x64-5.7.0.run
# 執行安裝過程並且等待完成
##安裝cmake
# ubuntu/debian
sudo apt-get install cmake -y
# rhel/centos/fedora
yum install cmake -y
# opensuse
zypper in cmake -y
安裝zlib
# ubuntu/debian
sudo apt-get install zlib1g-dev -y
# rhcl/centos/fedora
yum install zlib-dev -y
# opensuse
zypper in zlib-devel
編譯原始碼
# 進入到當前目錄下的WizQTClient
cd ./WizQTClient
./linux-package.sh
#--------- 正常輸出 ----------
1. 常見錯誤( No CMAKE_CXX_COMPILER could be found)
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
解決方法:
# 這個問題是沒有安裝cmake導致的
# ubuntu/debian
sudo apt-get install cmake -y
# rhel/centos/fedora
yum install cmake -y
# opensuse
zypper in cmake -y
2. 常見錯誤(Failed to find “GL/gl.h” in “/usr/include/libdrm”)
# Failed to find "GL/gl.h" in "/usr/include/libdrm"
zypper in libQt5OpenGL-devel
3. 常見錯誤(Failed to find “GL/gl.h”)
CMake Error at /opt/Qt/5.7/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
Failed to find "GL/gl.h" in "/usr/include/libdrm".
解決方法:
# 沒有安裝GL/GLX development files of the OpenGL API
zypper in Mesa-libGL-devel
4. 常見錯誤("QLocalSocket::connectToServer: Connection refused"閃退)
QLocalSocket::connectToServer: Connection refused
...
QSslSocket: cannot call unresolved function
然後程式閃退
解決方法:
# 解除安裝fcitx-qt5
zypper rm fcitx-qt5
# 重啟計算機
# 重新安裝 fcitx-qt5
zypper in fcitx-qt5
# 重啟計算機
# 重新安裝後就好了,原因沒有找到
# 其它Linux發行版本,請參考解決思路
5. 編譯到66%報錯(error: field ‘m_mutex’has incomplete type QMutex m_mutex;)
解決方法:
vim /home/tao/work/wz/WizQTClient/src/sync/WizKMSync.h
在標頭檔案引用裡面新增:#include <QMutex>
6. 常見錯誤(Could not find a package configuration file provided by “Qt5WebEngine”)
-- Checking to see if CXX compiler accepts flag -fprofile-arcs -ftest-coverage - yes
CMake Warning at /usr/lib64/cmake/Qt5Core/Qt5CoreMacros.cmake:325 (find_package):
Could not find a package configuration file provided by "Qt5WebEngine" with
any of the following names:
Qt5WebEngineConfig.cmake
qt5webengine-config.cmake
Add the installation prefix of "Qt5WebEngine" to CMAKE_PREFIX_PATH or set
"Qt5WebEngine_DIR" to a directory containing one of the above files. If
"Qt5WebEngine" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
cmake/QtChooser.cmake:47 (qt5_use_modules)
lib/quazip/CMakeLists.txt:8 (qt_use_modules)
CMake Error at /usr/lib64/cmake/Qt5Core/Qt5CoreMacros.cmake:327 (message):
Can not use "WebEngine" module which has not yet been found.
Call Stack (most recent call first):
cmake/QtChooser.cmake:47 (qt5_use_modules)
lib/quazip/CMakeLists.txt:8 (qt_use_modules)
-- Configuring incomplete, errors occurred!
See also "/home/tao/learn/wizhi/WizQTClient-Release-Linux/CMakeFiles/CMakeOutput.log".
See also "/home/tao/learn/wizhi/WizQTClient-Release-Linux/CMakeFiles/CMakeError.log".
cp: 無法獲取"../../WizQTClient-Release-Linux/bin/WizNote" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"/usr/lib/x86_64-linux-gnu/libQtWebKit.so.4" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"/usr/lib/x86_64-linux-gnu/libQtGui.so.4" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"/usr/lib/x86_64-linux-gnu//libQtXml.so.4" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"/usr/lib/x86_64-linux-gnu/libQtNetwork.so.4" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"/usr/lib/x86_64-linux-gnu/libQtCore.so.4" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"../../../../WizQTClient-Release-Linux/lib/wiznote/plugins/libextensionsystem.so" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"../../../../WizQTClient-Release-Linux/lib/wiznote/plugins/libaggregation.so" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"../../../../WizQTClient-Release-Linux/lib/wiznote/plugins/libCore.so" 的檔案狀態(stat): 沒有那個檔案或目錄
cp: 無法獲取"../WizQTClient-Release-Linux/share" 的檔案狀態(stat): 沒有那個檔案或目錄
WizNote/
WizNote/bin/
WizNote/lib/
WizNote/lib/wiznote/
WizNote/lib/wiznote/plugins/
WizNote/WizNote
解決方法:
vim CMakeLists.txt
# 新增一行環境變數 看下圖第19行
set(CMAKE_PREFIX_PATH "/opt/Qt/5.7/gcc_64")
編譯成功
到達100%編譯成功
#(三) 安裝後的啟動
cd ../WizNote
./WizNote
# 可以運行了吧
(四) 啟動可能遇到的問題(2018-08-04更新)
無法連線網路(無法登陸)
作業系統版本:opensuse 15.0/ opensuse Tumbleweed
在WizNote官網上有這樣一句話:
# Ubuntu 18.04 下執行前
# 請先執行
# sudo apt install openssl1.0 libssl1.0-dev ,再雙擊執行綠色版
# 因為在18年之後的發行版預設安裝的openssl版本為1.1沒有1.0
# 但是suse下面沒有openssl1.0-dev
# 其實只是名稱變化了安裝需要執行以下命令,並選擇斷開依賴
zypper in libopenssl-1_0_0-devel
# 在某些opensuse版本上安裝libopenssl-1_0_0會出現無法安裝的情況也無法斷開依賴,因此
xf-ws:/opt # rpm -qa |grep libopenssl (opensuse 42.3上可以正常安裝)
libopenssl1_0_0-32bit-1.0.2j-25.1.x86_64
libopenssl1_0_0-1.0.2j-25.1.x86_64
xf-ws:/opt # rpm -ql libopenssl1_0_0-1.0.2j-25.1.x86_64 (下面幾個檔案是安裝1.0.0版本的庫檔案)
/lib64/engines <---------------
/lib64/engines/libgost.so <--------------
/lib64/engines/libpadlock.so <----------------
/lib64/libcrypto.so.1.0.0 <----------------
/lib64/libssl.so.1.0.0 <-----------------
# 只要把它們複製到目標opensuse機器的相同目錄就OK了,不用zypper install ...
# 其它Linux作業系統也可參考此操作方法