[Qbs] Failed 'PackageBuild' product on QBS 1.22

Christian Kandeler christian.kandeler at qt.io
Tue May 10 16:49:46 CEST 2022


On 5/10/22 15:02, Карелин Павел wrote:
>
>
> 05.05.2022 12:14, Christian Kandeler пишет:
>> On 5/5/22 11:00, Карелин Павел wrote:
>>>
>>>
>>> 05.05.2022 10:47, Christian Kandeler пишет:
>>>> On 5/4/22 18:18, Карелин Павел wrote:
>>>>> Christian, how would you solve my problem?
>>>>> After the project is built, the deb-package is assembled. To build 
>>>>> the deb-package, you need a list of dependent libraries (not all, 
>>>>> only parts, system dependencies no required). For example this list:
>>>>>
>>>>> /opt/ffmpeg/4.4/lib/libavutil.so*
>>>>> /opt/ffmpeg/4.4/lib/libswscale.so*
>>>>> /opt/ffmpeg/4.4/lib/libswresample.so*
>>>>> /opt/opencv/4.5.5/lib/libopencv_core.so*
>>>>> /opt/opencv/4.5.5/lib/libopencv_calib3d.so*
>>>>> /opt/opencv/4.5.5/lib/libopencv_imgproc.so*
>>>>>
>>>>> I can get library paths and names of so-modules from dependencies:
>>>>>
>>>>> Depends { name: "lib.ffmpeg" }
>>>>> Depends { name: "lib.opencv" }
>>>>>
>>>>> How can I create such a list and put it in the package_build_info 
>>>>> file? With the rules?
>>>> lib.ffmpeg and lib.opencv are modules in your projects?
>>> Yes, they are modules. I use my own QBS-extensions to include 
>>> third-party assembled libraries in my projects 
>>> (https://github.com/hkarel/QbsExt/tree/master/modules/lib).
>>
>> Then I think the correct way is to
>>
>>     - collect these libraries in a Group in the respective module
>>
>>     - mark them as target artifacts (see 
>> https://doc.qt.io/qbs/qml-qbslanguageitems-group.html#filesAreTargets-prop)
>>
>>     - give them a suitable tag
>>
>>     - on the consuming side, create a rule whose 
>> inputsFromDependencies matches that tag and in this rule, do whatever 
>> you need to do.
>
> Tried to follow you recommendation:
>
> --- LibModule ---
> Module {
>     id: libmod
>     property string prefix
>     property string version: ""
>
>     property bool enabled: true
>     property bool useSystem: false
>
>     property string includeSuffix: "/include"
>     property string libSuffix: "/lib"
>
>     property path includePath: (useSystem || !enabled)
>                                ? undefined
>                                : prefix + (version.length ? "/" + 
> version : "") + includeSuffix
>
>     property path libraryPath: (useSystem || !enabled)
>                                ? undefined
>                                : prefix + (version.length ? "/" + 
> version : "") + libSuffix
>
>     property var dynamicLibraries: ["sodium"]
>     property var staticLibraries: []
>     ...
>     Group {
>         //name: "package-build"
>         fileTags: "package-build"
>         filesAreTargets: true
>         files: {
>             var libfiles = [];
>             if (!libmod.useSystem && libmod.enabled)
>                 for (var i in libmod.dynamicLibraries) {
>                     libfiles.push(
>                         libmod.libraryPath +
> ("/lib{0}.so*").format(libmod.dynamicLibraries[i]))
>                 }
>
>             console.info("=== libfiles ===");
>             console.info(libfiles);
>
>             return libfiles;
>         }
>     }
> } // Module
>
> LibModule {
>     id: sodium
>     version: "1.0.x"
>     prefix: "/opt/sodium"
>     checkingHeaders:  ["sodium.h"]
>     dynamicLibraries: ["sodium"]
>     staticLibraries:  ["sodium"]
> }
>
> Product {
>     name: "ToxPhone"
>     ...
>     Depends { name: "lib.sodium" }
>     ...
>     lib.sodium.version:   project.sodiumVersion
>     //lib.sodium.useSystem: project.useSystemSodium
>
>     Rule {
>         id: pkgbuild
>         //inputs: ["package-build"]
>         inputsFromDependencies: ["package-build"]
>
>         Artifact {
>             fileTags: ["package-build-file"]
>             filePath: FileInfo.joinPaths(project.buildDirectory, 
> "package_build_info")
>         }
>         prepare: {
>             var outputFile = 
> FileInfo.joinPaths(project.buildDirectory, "package_build_info");
>
>             console.info("=== outputFile ===");
>             console.info(outputFile);
>         }
>     }
>
> } // Product
>
> The inscription "=== outputFile ===" is never printed. What am I doing 
> wrong?
>
Did you remember to connect the "package-build-file" tag to your product 
type? Either by making this tag the product type or via a chain of rules.


Christian





More information about the Qbs mailing list