{"id":33976,"date":"2024-06-06T10:55:50","date_gmt":"2024-06-06T02:55:50","guid":{"rendered":"https:\/\/www.deepin.org\/?p=33976"},"modified":"2024-06-11T15:52:45","modified_gmt":"2024-06-11T07:52:45","slug":"linglong-10-minute-quick-build-guide","status":"publish","type":"post","link":"https:\/\/www.deepin.org.cn\/en\/linglong-10-minute-quick-build-guide\/","title":{"rendered":"Linglong 10-Minute Quick Build Guide!"},"content":{"rendered":"<img loading=\"lazy\" src=\"https:\/\/storage.deepin.org\/thread\/202406060535438081_en.png\" alt=\"\" width=\"900\" height=\"383\" \/><\/p>\n<h1><strong>Linglong<\/strong><\/h1>\n<p>As a new type of independent package management toolkit, Linglong primarily provides a layered and isolated operating environment, addressing compatibility issues caused by strong dependencies in traditional package management systems, as well as security issues resulting from lax permissions. Currently, Linglong supports four distributions, including deepin, UnionTech UOS, Debian, and Ubuntu. Linglong's isolation technology can completely decouple applications from the system, thereby thoroughly resolving compatibility conflicts between the system and applications, and among applications themselves, caused by upgrades and adaptation. For developers, this can effectively reduce development costs; for customers, it can reduce enterprise operational costs; and for the entire industry, it will help the industry to develop steadily.<\/p>\n<p>&nbsp;<\/p>\n<h1 style=\"text-align: center;\"><strong>Install Linglong<\/strong><\/h1>\n<p>This article will introduce the installation of Linglong on UOS 1070 and deepin V23.<\/p>\n<blockquote>\n<p style=\"text-align: left;\">Note: This document is applicable to version 1.5.0, please use\u00a0 \"ll-cli -- version\" \u00a0to check your Linglong program version.<\/p>\n<\/blockquote>\n<p>Linglong consists of three parts:<\/p>\n<ul>\n<li>ll-builder is used for building and debugging Linglong applications, provided by linglong-builder;<\/li>\n<li>ll-box is a sandbox container, provided by linglong-box;<\/li>\n<li>ll-cli is for managing and running Linglong applications, provided by linglong-bin.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2><strong>1\u3001UOS 1070<\/strong><\/h2>\n<p>Currently supports amd64, arm64, and loongarch64 (Loongson old world) architectures.<\/p>\n<p><strong>1)\u00a0 Add Linglong repository source<\/strong><\/p>\n<blockquote><p>echo\u00a0\"deb [trusted=yes] https:\/\/ci.deepin.com\/repo\/deepin\/deepin-community\/linglong-repo\/ unstable main\"\u00a0|\u00a0sudo\u00a0tee\u00a0-a\u00a0\/etc\/apt\/sources.list<\/p><\/blockquote>\n<p><strong>2) Install the Linglong build toolkit<\/strong><\/p>\n<blockquote><p>sudo\u00a0apt\u00a0update<\/p>\n<p>sudo\u00a0apt\u00a0install\u00a0linglong-builder\u00a0linglong-box\u00a0linglong-bin<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h2><strong>2\u3001deepin V23<\/strong><\/h2>\n<p>Currently supports amd64 and arm64 architectures.<\/p>\n<blockquote><p>sudo\u00a0apt\u00a0install\u00a0linglong-builder\u00a0linglong-box\u00a0linglong-bin<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h1 style=\"text-align: center;\"><strong>Install the Pica Tool<\/strong><\/h1>\n<p>This tool currently offers the capability to convert deb packages into Linglong packages, generate the linglong.yaml file needed for building Linglong applications, and relies on ll-builder to implement application building and exportation.<\/p>\n<h2><strong>1\u3001UOS 1070<\/strong><\/h2>\n<p>Currently supports amd64 and arm64 architectures.<\/p>\n<p>According to the Linglong installation steps, add the Linglong repository source.<\/p>\n<blockquote><p>sudo\u00a0apt\u00a0install\u00a0linglong-pica<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h2><strong>2\u3001deepin V23<\/strong><\/h2>\n<p>Currently supports amd64 and arm64 architectures.<\/p>\n<blockquote><p>sudo\u00a0apt\u00a0install\u00a0linglong-pica<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h1 style=\"text-align: center;\"><strong>10-Minute Quick Build<\/strong><\/h1>\n<p>Visit the Linglong official website to obtain the 10-Minute Quick Build Guide\uff08<a href=\"https:\/\/linglong.dev\/\">https:\/\/linglong.dev\/<\/a>\uff09.<\/p>\n<h2><strong>1\u3001Building an Example from Scratch<\/strong><\/h2>\n<p>Use <code class=\"inlineCode___KhxNe\">deepin-calculator<\/code> as an example to build a Linglong application from source code. The appid for a Linglong application should be named using a reversed domain name notation<\/p>\n<p><strong>1\uff09Create<\/strong><\/p>\n<blockquote><p>mkdir\u00a0org.deepin.calculator<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p>Create a \"linglong.yaml file\"\u00a0 in the directory<\/p>\n<blockquote><p>touch\u00a0org.deepin.calculator\/linglong.yaml<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p>Enter the directory<\/p>\n<blockquote><p>cd\u00a0org.deepin.calculator<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p>Edit the linglong.yaml file using a text editor.<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter\" src=\"https:\/\/storage.deepin.org\/thread\/202406060248063705_1.jpg\" alt=\"\" width=\"567\" height=\"993\" \/><\/p>\n<p>linglong.yaml file follows the YAML syntax specifications.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2\uff09Build<\/strong><\/p>\n<blockquote><p>ll-builder\u00a0build<\/p><\/blockquote>\n<p>Wait for the Linglong application to be built.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>3\uff09Run the Linglong application<\/strong><\/p>\n<blockquote><p>ll-builder\u00a0run<\/p><\/blockquote>\n<p>If the ll-builder run command is successful, the output will be as follows:<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter\" src=\"https:\/\/storage.deepin.org\/thread\/202406060249266604_2.jpg\" alt=\"\" width=\"456\" height=\"692\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>For easier debugging, you can use the additional\u00a0 \"--exec \/bin\/bash\" parameter to replace the default program that is executed after entering the container, like this:<\/p>\n<blockquote><p>ll-builder\u00a0run\u00a0--exec\u00a0\/bin\/bash<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h2><strong>2\u3001Converting deb Applications<\/strong><\/h2>\n<p>Using Baidu Netdisk as an example, this section introduces the process of converting a deb package into a Linglong package. Currently, only software that adheres to the app store's packaging standards can be converted.<\/p>\n<p><strong>1\uff09Obtain the deb package file<\/strong><\/p>\n<blockquote><p>apt\u00a0download\u00a0com.baidu.baidunetdisk<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p><strong>2\uff09Convert the application<\/strong><\/p>\n<blockquote><p>ll-pica\u00a0convert\u00a0-c\u00a0com.baidu.baidunetdisk_4.17.7_amd64.deb\u00a0-w\u00a0work\u00a0-b<\/p><\/blockquote>\n<p>Enter the directory<\/p>\n<blockquote><p>cd\u00a0work\/package\/com.baidu.baidunetdisk\/amd64<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p><strong>3\uff09Install the layer file<\/strong><\/p>\n<blockquote><p>ll-cli\u00a0install\u00a0.\/com.baidu.baidunetdisk_4.17.7.0_x86_64_runtime.layer<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p><strong>4\uff09Run the application<\/strong><\/p>\n<blockquote><p>ll-cli run com.baidu.baidunetdisk<\/p><\/blockquote>\n<p><img loading=\"lazy\" src=\"https:\/\/storage.deepin.org\/thread\/202406060250534425_3.jpg\" alt=\"\" width=\"868\" height=\"620\" \/><\/p>\n<p>&nbsp;<\/p>\n<h1 style=\"text-align: center;\"><strong>Common Issues<\/strong><\/h1>\n<h2><strong>1\u3001Common Build Issues<\/strong><\/h2>\n<p><strong>1)\u00a0 For cmake-based builds, if you encounter a failure with `-lxxxxx` but can find the library information with both `ldconfig` and `pkg-config`.<\/strong><\/p>\n<p>The library path is not in the standard path, and the new path is `\/runtime\/lib`.<\/p>\n<p>Add the environment variable `LIBRARY_PATH=&lt;libpath&gt;`. The current build environment already includes this environment variable by default.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2\uff09Failure to link static libraries during build, requiring a rebuild with fPIC.<\/strong><\/p>\n<p>Use the -fPIC parameter when building static libraries.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>3\uff09Failure to start the box during build, as shown in the figure below:<\/strong><\/p>\n<p><img src=\"https:\/\/storage.deepin.org\/thread\/202406060251038718_4.jpg\" alt=\"\" \/><\/p>\n<p>The kernel does not support unprivileged namespaces, solve this by enabling unprivileged namespaces.<\/p>\n<blockquote><p>sudo\u00a0sysctl\u00a0-w\u00a0kernel.unprivileged_userns_clone=1<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<div class=\"container___hZllz\">\n<div class=\"main___dsnkV\">\n<div class=\"content___hMdwe\">\n<div class=\"markdown___Ho3m0\">\n<p><strong>4) The qtbase build is successful, but it is not possible to build qt applications, with errors related to the module and mkspec.<\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>There is an issue with the lower version of the fuse-overlay mount, which leads to file content corruption when qtbase is committed, making it unusable. Use a version of fuse-overlayfs that is &gt;= 1.7.<\/p>\n<p>&nbsp;<\/p>\n<h2><strong>2\u3001Common Runtime Issues<\/strong><\/h2>\n<p><strong>1\uff09Why does the application fail to read the installation resource files under \/usr\/share when running?<\/strong><\/p>\n<p>Linglong applications run in a container environment, and application data is mounted under \/opt\/apps\/&lt;appid&gt;\/. The \/usr\/share directory will only contain system data and will not contain application-related data. Therefore, reading directly from \/usr\/share will fail.<\/p>\n<p>Suggestion: Use the XDG_DATA_DIRS environment variable to read resources. The path \/opt\/apps\/&lt;appid&gt;\/files\/share will be included in the search path of this environment variable.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2\uff09Why can't the application find the font library files when running? Why could they be read when the deb package was installed?<\/strong><\/p>\n<p>When a deb package is installed, it brings along the corresponding font library files as dependencies. In contrast, the Linglong package format uses a self-contained packaging format.<\/p>\n<p>Apart from the basic system libraries and the Qt and DTK library files provided in the runtime, all other dependent data files must be provided by yourself.<\/p>\n<p>Suggestion: Place the corresponding data files in files\/share and use the environment variable XDG_DATA_DIRS to read the paths.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>3\uff09What is inside the Linglong application runtime? Can I add some library files to it?<\/strong><\/p>\n<p>The runtime that Linglong applications currently depend on provides Qt libraries and DTK libraries. Due to strict size limitations on the runtime, it is not currently allowed to add additional library files to the runtime.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>4\uff09Can configuration files be created at any path within the container during the application's runtime?<\/strong><\/p>\n<p>Configuration files can be created under `XDG_CONFIG_HOME`.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>5) Where is the application data saved? Where can it be found outside the container?<\/strong><\/p>\n<p>Because Linglong applications follow the principle of non-interference.<\/p>\n<p>The environment variables<\/p>\n<ul>\n<li>XDG_DATA_HOME,<\/li>\n<li>XDG_CONFIG_HOME,<\/li>\n<li>XDG_CACHE_HOME<\/li>\n<\/ul>\n<p>are defined to point to the corresponding paths on the host machine at \"~\/.linglong\/&lt;appid&gt;\/.\" . Therefore, user application data is saved at this path. During the application's runtime, any data written should be done by reading and writing to the corresponding environment variables. It is forbidden to read from or write to the configurations of other applications.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>6\uff09How to place the provided D-Bus service file? What should be written in the Exec section?<\/strong><\/p>\n<p>When an application provides a D-Bus service file, it needs to be placed in the `entries\/dbus-1\/services` directory. If the Exec section is to execute a binary within the Linglong package, use the `--exec` option parameter to execute the corresponding binary.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>7\uff09After the application is installed, the launcher cannot be found?<\/strong><\/p>\n<p>If `TryExec=xxx` is used and `xxx` is not found in the `$PATH`, the application will be considered non-existent and will not be displayed.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>8\uff09 Why does the icon appear as a small black dot?<\/strong><\/p>\n<p>The `.desktop` file has an `Icon` field specified, but the name of the icon field is incorrect or an absolute path is used.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>9\uff09Why does the icon appear as a gear?<\/strong><\/p>\n<p>The `.desktop` file does not provide an `Icon` field.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>10\uff09Where are the icons stored?<\/strong><\/p>\n<p>For SVG icons:<\/p>\n<p>svg\u00a0\u2192$PREFIX\/share\/icons\/hicolor\/scalable\/apps\/<\/p>\n<p>For other formats according to resolution, such as 16x16:<\/p>\n<p>png\/xpm\u00a0\u2192\u00a0$PREFIX\/share\/icons\/hicolor\/16X16\/apps\/<\/p>\n<p>&nbsp;<\/p>\n<p><strong>11\uff09Why do the application's own xdg-open and xdg-email fail to work?<\/strong><\/p>\n<p>In the runtime, Linglong has special handling for xdg-open and xdg-email, so applications are prohibited from executing their own carried xdg-open and xdg-email executables or scripts.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>12\uff09Why are the system environment variables not effective when used by the application?<\/strong><\/p>\n<p>When using environment variables, it is necessary to confirm whether the corresponding environment variables exist within the container. If they do not exist, you may need to contact the Linglong team for assistance.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>13\uff09How to provide missing library files required for application execution?<\/strong><\/p>\n<p>The application itself needs to provide the resource files and library files it requires. Place the library files in the $PREFIX\/lib directory.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>14\uff09Why does the Qt WebEngine rendering process crash during application runtime?<\/strong><\/p>\n<p>The system upgrade of glibc has caused the application to fail when using the built-in browser, requiring the application to be re-adapted.<\/p>\n<p>A temporary solution is to set the environment variable:<\/p>\n<p>export QTWEBENGINE_DISABLE_SANDBOX=1\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>15\uff09Why can't the application find the\u00a0libqxcb.so\u00a0library or why does qtwebengine report an error?<\/strong><\/p>\n<p>If a qt.conf file exists, configure the correct path in the file, or use the following environment variables to configure the search paths:<\/p>\n<p>QTWEBENGINEPROCESS_PATH<br \/>\nQTWEBENGINE_RESOURCES_PATH<br \/>\nQT_QPA_PLATFORM_PLUGIN_PATH<br \/>\nQT_PLUGIN_PATH<\/p>\n<p>&nbsp;<\/p>\n<p><strong>16\uff09Can the application carry its own database files and write data to the database during runtime?<\/strong><\/p>\n<p>The file system within the container is a read-only file system, and writing data to the application resource files is not allowed.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>17) Why does the execution of binaries with SUID or GUID permissions fail?<\/strong><\/p>\n<p>To ensure system security, Linglong containers prohibit the execution of binaries with such permissions.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>18) Why can't the input method in the uab offline package format be used on Debian or Ubuntu?<\/strong><\/p>\n<p>It is recommended to install the fictx input method and then try it out.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>19)\u00a0 How do you know which packages are installed in the container environment?<\/strong><\/p>\n<p>Use ll-builder run --exec bash to enter the container environment, then use the command cat \/var\/lib\/dpkg\/status | grep \"^Package: \" to view the pre-installed software packages. Additionally, for libraries compiled from source, you can use cat \/runtime\/packages.list to view them.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Scan the QR code below to join the Linglong community on WeChat:<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"aligncenter\" src=\"https:\/\/storage.deepin.org\/thread\/202406060253212540_5.jpg\" alt=\"\" width=\"200\" height=\"200\" \/><\/p>\n<p>&nbsp;<\/p>\n<div>\n<h1><strong>Appendix:<\/strong><\/h1>\n<p>1)\u00a0 \u00a0deepin V23 RC ISO :<a href=\"https:\/\/www.deepin.org\/en\/download\/\"> https:\/\/www.deepin.org\/en\/download\/<\/a><\/p>\n<p>2)\u00a0 deepin Previous Versions: https:\/\/distrowatch.com\/table.php?distribution=deepin<\/p>\n<p style=\"text-align: right;\">Content source: deepin community<br \/>\nReprinted with attribution<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Linglong As a new type of independent package management toolkit, Linglong primarily provides a layered and isolated operating environment, addressing compatibility issues caused by strong dependencies in traditional package management systems, as well as security issues resulting from lax permissions. Currently, Linglong supports four distributions, including deepin, UnionTech UOS, Debian, and Ubuntu. Linglong's isolation technology can completely decouple applications from the system, thereby thoroughly resolving compatibility conflicts between the system and applications, and among applications themselves, caused by upgrades and adaptation. For developers, this can effectively reduce development costs; for customers, it can reduce enterprise operational costs; and for the ...<a href=https:\/\/www.deepin.org.cn\/en\/linglong-10-minute-quick-build-guide\/>Read more<\/a><\/p>\n","protected":false},"author":11164,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[155,93],"tags":[],"_links":{"self":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts\/33976"}],"collection":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/users\/11164"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/comments?post=33976"}],"version-history":[{"count":13,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts\/33976\/revisions"}],"predecessor-version":[{"id":34003,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/posts\/33976\/revisions\/34003"}],"wp:attachment":[{"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/media?parent=33976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/categories?post=33976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deepin.org.cn\/en\/wp-json\/wp\/v2\/tags?post=33976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}