[Qbs] Deployment and dependency bundling

Richard Weickelt richard at weickelt.de
Sat Dec 28 13:56:55 CET 2019


> I've got it working to some point by adding these properties to the Rule:
> 
>     inputsFromDependencies: ["application", "dynamiclibrary"]
>     multiplex: true
>     outputFileTags: ["deployed_library"]
> 
> but this causes the Rule to be run only for the application's
> dependencies, and not for the application itself. Adding
> 
>     inputs: ["application"]
> 
> seems to solve the issue, however for some strange reason (at least,
> strange to me) if the Product using this module is not an application,
> but a shared library, QBS will try to also build the product as an
> application (and this will fail, not last because main() is not
> defined). This is not a big issue, since anyway I'd expect this module
> to be used only for applications, but if possible I'd like to avoid
> hardcoding the input to "application".

Are you sure you haven't added "application" by accident to the output file
tags in your rule or as additionalProductType in your module? Please create
a minimal and complete example showing this behavior and open a bug report
if the problem persists.

> I also tried replacing the `inputs` property with
> 
>    inputs: products.type
> 
> but this causes QBS to fail with this error:

I guess you have added "deployed_library" somehow to the product's type in
order to run the rule. This would create a cycle.

> Or maybe my approach is totally off, and it would be better to implement
> dependency deployment as a Product 

A separate product is the usual way:
https://code.qt.io/cgit/qbs/qbs.git/tree/src/shared/bundledqt/bundledqt.qbs
https://github.com/bjorn/tiled/blob/master/dist/distribute.qbs

These are rather pragmatic solutions, but of course not very beautiful.

> (since, ultimately, one would use it
> to obtain a MacOS package, an AppImage or a MSI package?)?
> Then, I suppose, just `inputsFromDependencies: ["application"]` would be
> enough?

Are you sure you want to go that far? I have some doubts that this would be
maintaible. Note that win/mac/linux-deployqt exist for a reason. And since I
supose that >99% of Qbs-managed desktop applications are based upon Qbs, it
might make sense to create a generic wrapper module for those tools.

You are currently only writing about resolving ELF dependencies with ldd.
Sure, ldd is available in every Linux distribution. But what about Windows
(PE)? Which dependency analyzer are you going to use? Windeployqt for
instance comes with its own code (which doesn't compile for Linux targets btw.).

Richard


More information about the Qbs mailing list