本仓库中的文档用于某些 Linux x64 发行版上的 BesLyric-for-X 的开发环境配置。
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。
返回主分支。
- 本文档可能不提供通过编译源码来配置环境的方法;
- 本文档可能不提供有关已结束支持的操作系统 [1] [2] [3] 和软件的内容;
- BesLyric-for-X 仅支持 Qt 5.12.4 及更高版本。
- 1. 有效性参考
- 2. BesLyric-for-X 项目配置
- 3. 配置开发环境
- 4. 异常处理
- 5. 脚注
- 6. 参考
- 7. 其他
按照本文档进行配置后,通过测试的操作系统与开发环境的版本组合:
OS & Kernel | Compiler | Qt | SDL | FFmpeg | TLS Impl. | |||
---|---|---|---|---|---|---|---|---|
Ubuntu 20.04 LTS & 5.4.0-40-generic | 9.3.0 (Ubuntu 9.3.0-10ubuntu2) |
|
2.0.10 | 4.2.2-1ubuntu1 | OpenSSL 1.1.1f 31 Mar 2020 | |||
Fedora release 32 (Thirty Two) & 5.7.16-200.fc32.x86_64 | 10.2.1 20200723 (Red Hat 10.2.1-1) (GCC) |
|
2.0.12 | 4.2.4 | OpenSSL 1.1.1g FIPS 21 Apr 2020 | |||
Manjaro Linux xfce 20.0.3 & 5.6.19-2-MANJARO | 10.1.0 (GCC) |
|
2.0.12 | n4.2.4 | OpenSSL 1.1.1g 21 Apr 2020 | |||
openSUSE Leap 15.2 & 5.3.18-lp152.33-default | 7.5.0 (SUSE Linux) |
|
2.0.8 | 4.2.1-lp152.1.4 | OpenSSL 1.1.1d 10 Sep 2019 | |||
Ubuntu 18.04.4 LTS & 5.3.0-62-generic | 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) |
|
2.0.8 | 4.3-2~18.04.york0 | OpenSSL 1.1.1 11 Sep 2018 |
不需要对项目进行额外的配置。
# apt update && \
apt install build-essential pkg-config git
# dnf check-update && \
dnf groupinstall \
"Development Tools" \
"C Development Tools and Libraries"
如有需要,可以启用“ FastestMirror ”插件 [4] [5] 使dnf
选择最低时延的镜像服务器。
# pacman --sync --refresh && \
pacman --sync base-devel gdb git
# zypper refresh && \
zypper install --type pattern devel_C_C++ && \
zypper install pkg-config git
# apt install git qt5-default qtcreator
# dnf install qt5-devel qt-creator
# pacman --sync qt5-base qtcreator
# zypper install --type pattern devel_qt5
- 从 Index of /official_releases/online_installers 下载在线安装程序;
- 安装时记得勾选当前编译环境对应的预构建组件( Pre-built Components ),例如“ Qt / Qt 5.15.0 / Desktop gcc 64-bit ”。
# apt install libgl1-mesa-dev
# dnf install mesa-libGL-devel
# pacman --sync mesa
# zypper install Mesa-libGL-devel
# apt install libsdl2-dev
# dnf install SDL2-devel
# pacman --sync sdl2
# zypper install libSDL2-devel
# apt install \
ffmpeg \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
libpostproc-dev \
libswresample-dev \
libswscale-dev
# dnf install \
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm && \
dnf install ffmpeg-devel
# pacman --sync ffmpeg
# zypper install \
ffmpeg-4-libavcodec-devel \
ffmpeg-4-libavdevice-devel \
ffmpeg-4-libavfilter-devel \
ffmpeg-4-libavformat-devel \
ffmpeg-4-libavutil-devel \
ffmpeg-4-libpostproc-devel \
ffmpeg-4-libswresample-devel \
ffmpeg-4-libswscale-devel
添加 PPA :
# add-apt-repository ppa:jonathonf/ffmpeg-4
如果 PPA 访问缓慢,可以使用 ustclug 提供的反向代理 [8] 。有人提供了一个替换 URL 的正则表达式 [9] ,我对其进行了一些修改使其仅使用 https :
# find /etc/apt/sources.list.d/ -type f -name "*.list" -exec \
sed -i.bak -r 's#deb(-src)?\s*http(s)?://ppa.launchpad.net#deb\1 https://launchpad.proxy.ustclug.org#ig' {} \;
安装:
# apt install \
ffmpeg \
libavcodec-dev \
libavdevice-dev \
libavformat-dev \
libavfilter-dev \
libavutil-dev \
libpostproc-dev \
libswresample-dev \
libswscale-dev
运行程序时出现错误:
$ ./binary
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.
Aborted (core dumped)
设置环境变量QT_DEBUG_PLUGINS=1
再次运行程序:
$ QT_DEBUG_PLUGINS=1 ./binary
QFactoryLoader::QFactoryLoader() checking directory path "/the/path/to/Qt/5.15.0/gcc_64/plugins/platforms" ...
...
Got keys from plugin meta data ("xcb")
...
Cannot load library /the/path/to/Qt/5.15.0/gcc_64/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/the/path/to/Qt/5.15.0/gcc_64/plugins/platforms/libqxcb.so" : "Cannot load library /the/path/to/Qt/5.15.0/gcc_64/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)"
...
Aborted (core dumped)
系统中缺少 libxcb-xinerama ,搜索:
$ apt search libxcb-xinerama
Sorting... Done
Full Text Search... Done
libxcb-xinerama0/focal 1.14-2 amd64
X C Binding, xinerama extension
libxcb-xinerama0-dev/focal 1.14-2 amd64
X C Binding, xinerama extension, development files
安装:
# apt install libxcb-xinerama0
如果缺少其他的库,也按照上述方法进行安装。
- ^ Ubuntu release cycle | Ubuntu
https://ubuntu.com/about/release-cycle - ^ End of life - Fedora Project Wiki § Unsupported_Fedora_Releases
https://fedoraproject.org/wiki/End_of_life#Unsupported_Fedora_Releases - ^ Lifetime - openSUSE Wiki § Discontinued distributions
https://en.opensuse.org/Lifetime#Discontinued_distributions - ^ PackageManagement/Yum/FastestMirror - CentOS Wiki
https://wiki.centos.org/PackageManagement/Yum/FastestMirror - ^ Dnf fastest mirror on Fedora/CentOS/RHEL - Darryl Dias
https://darryldias.me/2020/how-to-setup-fastest-mirror-in-dnf/ - ^ Enabling the RPM Fusion repositories :: Fedora Docs Site
https://docs.fedoraproject.org/en-US/quick-docs/setup_rpmfusion/ - ^ How to Install FFmpeg on Ubuntu 18.04 - Linux4one
https://linux4one.com/how-to-install-ffmpeg-on-ubuntu-18-04/ - ^ Revproxy - LUG @ USTC
https://lug.ustc.edu.cn/wiki/mirrors/help/revproxy - ^ Issue #43 (comment) · ustclug/mirrorrequest
ustclug/mirrorrequest#43 (comment) - ^ qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. | Qt Forum
https://forum.qt.io/topic/93247/qt-qpa-plugin-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found - ^ Qt Creator + Ubuntu 20.04 | Qt Forum
https://forum.qt.io/topic/116299/qt-creator-ubuntu-20-04 - ^ "Failed to load platform plugin "xcb" " while launching qt5 app on linux without qt installed - Stack Overflow
https://stackoverflow.com/questions/17106315/failed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without - ^ “Failed to load platform plugin ”xcb“ ” while launching qt5 app on linux without qt installed - Ask Ubuntu
https://askubuntu.com/questions/308128/failed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without - ^ Identify pyqt5 515 ci issue by j9ac9k · Pull Request #1221 · pyqtgraph/pyqtgraph
pyqtgraph/pyqtgraph#1221 - ^ Re: [Interest] Qt 5.15 for Linux/X11 : "-qt-xcb" no longer supported?
https://www.mail-archive.com/[email protected]/msg34052.html
- 本文档在 VSCode 上使用 Markdown All in One 辅助编辑;
- 本文档中嵌套表格使用 HTML Table generator - TablesGenerator.com 辅助编辑。