After studying the previous chapter “Basic Knowledge of Linyaps Application Packaging”, we will now apply this knowledge to package a real-world application. This tutorial demonstrates compiling and testing the open-source graphical application qBittorrent from source code within a Linyaps container.

Preparation

According to the “Generic Resource Standards for Linyaps Packaging” mentioned in the basics chapter, graphical applications require icons and .desktop files to ensure desktop user experience. However, this tutorial focuses on compilation and testing within the container, so these resources are temporarily omitted.

System Requirements:

  1. A deepin 23 environment with ll-builder installed. Installation guide: Install Linyaps.
  2. Stable internet connection for downloading container runtime libraries and third-party dependencies.
  3. Prior experience compiling qBittorrent natively on a similar system (recommended).

Configure linglong.yaml

Create a minimal linglong.yaml to generate the container environment. Key points:

  • Omit detailed build rules for manual operations.
  • Include runtime section to ensure dependency coverage.
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.  
#  
# SPDX-License-Identifier: LGPL-3.0-or-later  
​
version: "4.6.7.2"  
​
package:  
  id: org.qbittorrent.qBittorrent  
  name: "qBittorrent"  
  version: 4.6.7.2  
  kind: app  
  description: |  
    qBittorrent binary  
​
base: org.deepin.foundation/23.0.0  
runtime: org.deepin.Runtime/23.0.1  
​
command:  
  - /opt/apps/org.qbittorrent.qBittorrent/files/bin/qbittorrent  
​
source:  
  - kind: local  
    name: "qBittorrent"  
​
build: |  
  mkdir -p ${PREFIX}/bin/ ${PREFIX}/share/  

Compilation Walkthrough

Key Reminder: The build directory (same level as linglong.yaml) is mapped to /project inside the container.

  1. Open two terminal windows:
    • Container Terminal: For operations inside the Linyaps container.
    • Host Terminal: For native file operations.
  2. Generate and enter the container:
szbt@szbt-linyaps23:/media/szbt/Data/ll-build/QT/qBittorrent-git$ ll-builder build --exec bash  

Successful entry is indicated by the path change:

szbt@szbt-linyaps23:/project$  
  1. Extract qBittorrent-4.6.7 source code using the Host Terminal:
szbt@szbt-linyaps23:/media/szbt/Data/ll-build/QT/qBittorrent-git$ tar -xvf qBittorrent-4.6.7-git-origin-src.tar.zst -C src/  
  1. Identify the build system by checking for CMakeLists.txt in the source directory (CMake project).

5. Check dependencies against qBittorrent INSTALL. Missing libraries in Linyaps base/runtime require manual compilation.

6. Configure the project inside the Container Terminal:

mkdir build  
cd build  
cmake -DCMAKE_BUILD_TYPE=Release \  
     -DCMAKE_INSTALL_PREFIX=$PREFIX ..  
  1. Resolve missing libtorrent-rasterbar>=1.2.19 error:
szbt@szbt-linyaps23:/project/src/qBittorrent-release-4.6.7-szbt2/build$ pkg-config --print-provides libtorrent-rasterbar  
  1. Download and compile libtorrent-rasterbar-2.0.9 source code using the Host Terminal, then re-enter the container.

9. Build the dependency:

mkdir build  
cd build  
cmake -DCMAKE_BUILD_TYPE=Release \  
     -DCMAKE_INSTALL_PREFIX=$PREFIX ..  
make -j$(nproc)  
make install  
  1. Recompile qBittorrent after resolving dependencies:
cd /project/src/qBittorrent-release-4.6.7-szbt2/build  
cmake -DCMAKE_BUILD_TYPE=Release \  
     -DCMAKE_INSTALL_PREFIX=$PREFIX ..  
make -j$(nproc)  
make install  

Testing the Build

Locate the compiled binary at /opt/apps/org.qbittorrent.qBittorrent/files/bin/qbittorrent and test it inside the container.

Note: Graphical tests require a desktop environment. If libraries are missing, use LD_LIBRARY_PATH to specify paths:

LD_LIBRARY_PATH=$PREFIX/lib ./qbittorrent  

Conclusion: The Qt5-based application qBittorrent is successfully compiled and runs in the Linyaps container!