Skip to content

Latest commit

 

History

History
367 lines (266 loc) · 13.3 KB

README.md

File metadata and controls

367 lines (266 loc) · 13.3 KB

BesLyric-for-X Development Environment Configuration (Linux x64, Chinese only)

简介

本仓库中的文档用于某些 Linux x64 发行版上的 BesLyric-for-X 的开发环境配置。

知识共享许可协议
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。

导航

返回主分支

注意

  • 本文档可能不提供通过编译源码来配置环境的方法;
  • 本文档可能不提供有关已结束支持的操作系统 [1] [2] [3] 和软件的内容;
  • BesLyric-for-X 仅支持 Qt 5.12.4 及更高版本。

目录

1. 有效性参考

按照本文档进行配置后,通过测试的操作系统与开发环境的版本组合:

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)
5.12.8 (apt)
5.12.9
5.15.0
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)
5.12.9
5.13.2 (dnf)
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)
5.15.0
5.15.0 (pacman)
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)
5.12.7 (zypper)
5.15.0
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)
5.12.9
5.14.2
5.15.0
2.0.8 4.3-2~18.04.york0 OpenSSL 1.1.1 11 Sep 2018

2. BesLyric-for-X 项目配置

不需要对项目进行额外的配置。

3. 配置开发环境

3.1. Git 与 C++ 开发环境

3.1.1. Ubuntu 18.04 及更高版本

# apt update && \
    apt install build-essential pkg-config git

3.1.2. Fedora 32

# dnf check-update && \
    dnf groupinstall \
      "Development Tools" \
      "C Development Tools and Libraries"

如有需要,可以启用“ FastestMirror ”插件 [4] [5] 使dnf选择最低时延的镜像服务器。

3.1.3. Manjaro

# pacman --sync --refresh && \
    pacman --sync base-devel gdb git

3.1.4. openSUSE Leap 15.2

# zypper refresh && \
    zypper install --type pattern devel_C_C++ && \
    zypper install pkg-config git

3.2. Qt 5.12.4 及更高版本

3.2.1. 包管理器

3.2.1.1. Ubuntu 20.04 及更高版本
# apt install git qt5-default qtcreator
3.2.1.2. Fedora 32
# dnf install qt5-devel qt-creator
3.2.1.3. Manjaro
# pacman --sync qt5-base qtcreator
3.2.1.4. openSUSE Leap 15.2
# zypper install --type pattern devel_qt5

3.2.2. 在线安装程序

  • Index of /official_releases/online_installers 下载在线安装程序;
  • 安装时记得勾选当前编译环境对应的预构建组件( Pre-built Components ),例如“ Qt / Qt 5.15.0 / Desktop gcc 64-bit ”。

3.3. 第三方库

3.3.1. OpenGL

3.3.1.1. Ubuntu 18.04 及更高版本
# apt install libgl1-mesa-dev
3.3.1.2. Fedora 32
# dnf install mesa-libGL-devel
3.3.1.3. Manjaro
# pacman --sync mesa
3.3.1.4. openSUSE Leap 15.2
# zypper install Mesa-libGL-devel

3.3.2. SDL 2

3.3.2.1. Ubuntu 18.04 及更高版本
# apt install libsdl2-dev
3.3.2.2. Fedora 32
# dnf install SDL2-devel
3.3.2.3. Manjaro
# pacman --sync sdl2
3.3.2.4. openSUSE Leap 15.2
# zypper install libSDL2-devel

3.3.3. FFmpeg 4

3.3.3.1. Ubuntu 20.04 及更高版本
# apt install \
    ffmpeg \
    libavcodec-dev \
    libavdevice-dev \
    libavfilter-dev \
    libavformat-dev \
    libavutil-dev \
    libpostproc-dev \
    libswresample-dev \
    libswscale-dev
3.3.3.2. Fedora 32

[6]

# dnf install \
    https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm && \
    dnf install ffmpeg-devel
3.3.3.3. Manjaro
# pacman --sync ffmpeg
3.3.3.4. openSUSE Leap 15.2
# 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
3.3.3.5. Ubuntu 18.04

[7]

添加 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

4. 异常处理

4.1. 缺少用于 Qt 5.15 的 libxcb

[10] [11] [12] [13] [14] [15]

运行程序时出现错误:

$ ./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

如果缺少其他的库,也按照上述方法进行安装。

5. 脚注

  1. ^ Ubuntu release cycle | Ubuntu
    https://ubuntu.com/about/release-cycle
  2. ^ End of life - Fedora Project Wiki § Unsupported_Fedora_Releases
    https://fedoraproject.org/wiki/End_of_life#Unsupported_Fedora_Releases
  3. ^ Lifetime - openSUSE Wiki § Discontinued distributions
    https://en.opensuse.org/Lifetime#Discontinued_distributions
  4. ^ PackageManagement/Yum/FastestMirror - CentOS Wiki
    https://wiki.centos.org/PackageManagement/Yum/FastestMirror
  5. ^ Dnf fastest mirror on Fedora/CentOS/RHEL - Darryl Dias
    https://darryldias.me/2020/how-to-setup-fastest-mirror-in-dnf/
  6. ^ Enabling the RPM Fusion repositories :: Fedora Docs Site
    https://docs.fedoraproject.org/en-US/quick-docs/setup_rpmfusion/
  7. ^ How to Install FFmpeg on Ubuntu 18.04 - Linux4one
    https://linux4one.com/how-to-install-ffmpeg-on-ubuntu-18-04/
  8. ^ Revproxy - LUG @ USTC
    https://lug.ustc.edu.cn/wiki/mirrors/help/revproxy
  9. ^ Issue #43 (comment) · ustclug/mirrorrequest
    ustclug/mirrorrequest#43 (comment)
  10. ^ 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
  11. ^ Qt Creator + Ubuntu 20.04 | Qt Forum
    https://forum.qt.io/topic/116299/qt-creator-ubuntu-20-04
  12. ^ "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
  13. ^ “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
  14. ^ Identify pyqt5 515 ci issue by j9ac9k · Pull Request #1221 · pyqtgraph/pyqtgraph
    pyqtgraph/pyqtgraph#1221
  15. ^ Re: [Interest] Qt 5.15 for Linux/X11 : "-qt-xcb" no longer supported?
    https://www.mail-archive.com/[email protected]/msg34052.html

6. 参考

7. 其他