#(一) 下载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操作系统也可参考此操作方法
Logo

更多推荐