1.准备
编译的基础依赖库
- yum install libtool autoconf automake check check-devel libsodium-devel opus-devel libvpx-devel libasan
- yum install gtk2-devel libexif-devel libXScrnSaver-devel openal-soft-devel openssl-devel qrencode-devel
- yum install qt-creator qt-devel qt-doc qt5-linguist qt5-qtsvg qt5-qtsvg-devel qtsingleapplication
2.安装ffmpeg库- 安装epel-release
- yum install epel-release
- 安装nux存储库
- rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
- 安装ffmpeg和ffmpeg -devel软件包yum install ffmpeg ffmpeg-devel
3.安装
sqlcipher源码编译安装- Githu上下sqlcipher源码
- yum install -y tcl.i686 tcl.x86_64 tcl-devel.i686 tcl-devel.x86_64
- 进入下载的sqlcipher源码目录中
- ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
- make & make install
准备工作完成后开始编译主要代码
使用的是cmake-3.23.0-rc5下载各源码 c-toxcore,
cmp,
toxext,tox_extension_messages,qTox- https://github.com/toktok/c-toxcore
- https://github.com/camgunz/cmp/tree/e836703291392aba9db92b46fb47929521fac71f
- https://github.com/toxext/toxext
- https://github.com/toxext/tox_extension_messages
- https://github.com/qTox/qTox
4.编译c-toxcore- 第一坑编译c-toxcore提示cmp的错误,原来是少cmp源码
- 下载cmp代码解压放入c-toxcore/third_party/cmp中
- cmake . -DBOOTSTRAP_DAEMON=OFF
- make -j$(nproc)
- make install
5.编译
toxext- export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig"
- cmake .
- make -j$(nproc)
- make install
6.编译
tox_extension_messages- cmake .
- make -j$(nproc)
- make install
7.编译
qTox- export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig"
- export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
- cmake .
- make -j$(nproc)
编译qTox的时候会碰到3类
错误 编译参数错误,没去找源头在哪里,直接把make文件中的
-Wnull-dereference和-Wduplicated-cond删除,大概有十来个地方。
这个
问题的原因是这2个参数是GCC6开始加入的新特性,但是centos7.6的是GCC是4.8.5,且不想升级GCC。
- c++: 错误:unrecognized command line option ‘-Wnull-dereference’
- c++: 错误:unrecognized command line option ‘-Wduplicated-cond’
- make[2]: *** [util/CMakeFiles/util_library.dir/util_library_autogen/mocs_compilation.cpp.o] 错误
- [backcolor=#f7f7f7][color=#000000]修改util/CMakeFiles/util_library.dir/[/color][/backcolor][color=#000000]flags.make中的[/color]-Wnull-dereference和-Wduplicated-cond[color=#000000][font=Arial]删除[/font][/color]
第二类错误
C++新特性不支持,需要修改源码,类构造函数初始化列表使用{}赋值,改成()赋值,几十处需要修改
- 错误:用类型为‘<brace-enclosed initializer list>’的右值初始化类型为‘IAudioSettings&’的非常量引用无效
- 修改前
- OpenAL::OpenAL(IAudioSettings& _settings)
- : settings{_settings}
- , audioThread{new QThread}
- 修改后
- OpenAL::OpenAL(IAudioSettings& _settings)
- : settings(_settings)
- , audioThread(new QThread)
第三类错误 关于字符串转
QString的错误 把比如 return "veron ";改成 return QString("veron ")
这个软件的厉害之处在于
任意两个在线的qTox,不需要公网上的中央服务器,两者之间直接传消息,语音,视频,
文件。