Skip to content

--linkage shared: two packages with one short name (compat.sdl3, mcpplibs.mwrap.sdl3) both make bin/libsdl3.so #975

Open

Description

@Sunrisepeak

mcpp 2026.11.18.1, Linux x86_64, GCC 16.1.

A program whose closure has two packages with the same short name, here compat.sdl3 (SDL's C sources) and mcpplibs.mwrap.sdl3 (its module wrap), packed with shared dependency linkage:

mcpp pack hello-im -p examples/01-hello-im --profile dist --linkage shared --pkg-format dir --mode vendored

fails while planning:

ninja: error: build.ninja:11782: multiple rules generate bin/libsdl3.so

build.ninja has two cxx_shared rules with that output, one with obj/compat_sdl3/... inputs and one with obj/mcpplibs_mwrap_sdl3/... inputs. The object directories are already told apart by namespace; the shared library's file name (and so its SONAME) is not.

Expected: each package's shared library has a name unique in the closure, e.g. one that carries the namespace, as the object directories do. #896 fixed the same collision for static links.

Workaround used here: the program declares one of the two itself with linkage = "static" (compat.sdl3 = { version = "3.4.18", linkage = "static" }), so only one libsdl3.so is made.

Activity

  1. Sunrisepeak commented on Nov 19, 2026

    @Sunrisepeak
    MemberAuthor

    Tried the workaround in the issue on the same program: with compat.sdl3 declared static by the program, the plan gets past libsdl3.so and stops at the next pair:

    ninja: error: build.ninja:11892: multiple rules generate bin/liblibpng.so
    

    It also warns that compat.sdl3, omui.host.sdl3 and mcpplibs.mwrap.sdl3 are static packages reached from more than one image, a graph refused on Mach-O, PE and Android. So declaring one package of each pair static is not a usable workaround. Every pair of a C library's compat.* package and its mcpplibs.mwrap.* wrap has this collision. The shared form needs names unique in the closure.

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