Skip to content

mcpp pack: take the dependencies of deployed shared libraries into the runtime closure #1011

Done

Description

@speak-agent

Summary

mcpp pack computes the runtime closure from the program only. A shared library that a build program places beside the program with mcpp::deploy (recorded as role: library in mcpp-package.json) is staged, but the libraries it depends on are not added to the closure. A plugin that is only ever dlopened (Qt platform plugins and QML plugins, GTK modules, and so on) therefore ships without its own dependencies, and the packed program fails on a machine that does not have them.

Reproduction (Linux x86_64, xim:qt 6.11.1, mcpp 2026.11.20.1)

  1. A Qt Quick program whose build.mcpp calls mcpp::deploy for qml/QtQuick/Layouts/libqquicklayoutsplugin.so (the file is in the SDK's qml/ tree) and for the SDK's plugins/platforms/*.so.
  2. mcpp pack --format dir.
  3. The packed lib/ has no libQt6QuickLayouts.so.6, although the deployed plugin has it in DT_NEEDED. The same holds for the platform plugins that mcpp.rules.qt already deploys: bin/platforms/libqxcb.so needs libQt6XcbQpa.so.6, libqwayland.so needs libQt6WaylandClient.so.6, libqeglfs.so needs libQt6EglFSDeviceIntegration.so.6; none of them is in the packed tree. (Checked statically over every ELF file in the packed tree; the xcb plugin loading failure on a real display is inferred, not observed.)

Control: if the program itself links libQt6QuickLayouts.so by full path, the library is in DT_NEEDED of the program and mcpp pack carries it. That is the workaround below.

Where

src/pack/pack.cppm: the closure read starts from one object, the program (ClosureReadInput::object = program, for example in the PE branch that reads the program's imports); the ELF path walks the program's loader trace. The deployed files are listed in the manifest but are not roots of that walk.

Expected

Either of these would do:

  • a deployed role: library file is also a root of the closure walk, resolved with the same rules and search directories as the program; or
  • a build-program directive that adds extra closure roots, for example mcpp::runtime_closure_root(file), for deployed files the author wants walked.

Current workaround

mcpp.rules.qt and the planned mcpp.rules.qml (mcpp-community/mcpp-plugins) read the dependency table of each deployed plugin and link the SDK libraries it names into the program. The workaround is idempotent (linking a library the engine also stages changes nothing) and marked in the source so it can be deleted once the engine does this. A CI canary in mcpp-plugins prints a notice as soon as a packed tree no longer needs it.

Activity

  1. speak-agent commented on Nov 24, 2026

    @speak-agent
    MemberAuthor

    Fixed in mcpp 2026.11.23.1 (#1006). An object the build deploys beside the program (mcpp::deploy, [runtime] deploy) is a root of the pack's runtime closure on ELF, PE, Mach-O and Android, and a deployed object's search path is rewritten to the packed lib/ (SPEC-014 §1.2 v2.7). Verified with xim:qt: libQt6XcbQpa is now packed. The mcpp.rules.qt workaround in mcpp-plugins can be removed once this release is the floor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions