Linux下编译安装WizNote

时间:2021-12-08 07:05:46

下载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下编译安装WizNote
下载比较慢耐心等待

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
#--------- 正常输出 ----------

常见错误( 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

常见错误(Failed to find “GL/gl.h” in “/usr/include/libdrm”)

# Failed to find "GL/gl.h" in "/usr/include/libdrm"
zypper in libQt5OpenGL-devel

常见错误(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

常见错误(“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发行版本,请参考解决思路

编译到66%报错(error: field ‘m_mutex’has incomplete type QMutex m_mutex;)

Linux下编译安装WizNote

解决方法:
vim /home/tao/work/wz/WizQTClient/src/sync/WizKMSync.h
在头文件引用里面添加:#include <QMutex>

Linux下编译安装WizNote

常见错误(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")

Linux下编译安装WizNote

编译成功

到达100%编译成功
Linux下编译安装WizNote

安装后的启动

cd ../WizNote
./WizNote
# 可以运行了吧