Skip to content

A source listed by exact path that matches no file is skipped silently; the build fails later at an importer #938

Closed

Description

@Sunrisepeak

What happens

A source listed by its exact path in [build] sources (or [target.'cfg(…)'.build] sources) that matches no file is skipped without a word. The build goes on and fails later, at an importer: failed to read compiled module. There's a warning before that (module 'demo.target' imported but not provided in this build), but nothing names the missing file.

We hit it when a .gitignore line target/ also ignored a source directory src/target/. Locally the file existed and everything built. On CI's fresh checkout it was missing, and every row failed on a module-ordering-looking error.

Reproduction (mcpp 2026.11.12.1, GCC 16.1.0, Linux)

# demo/mcpp.toml
[package]
name    = "demo"
version = "0.1.0"

[targets.demo]
kind = "lib"

[build]
sources = ["src/*/*.cppm"]

[target.'cfg(not(os = "emscripten"))'.build]
sources = ["src/target/unix/target.cppm"]   # this file does not exist

src/core/demo.cppm:

export module demo;
export import demo.target;

mcpp build prints:

warning: …/demo/src/core/demo.cppm: module 'demo.target' imported but not provided in this build
demo.target: error: failed to read compiled module: No such file or directory
demo.target: fatal error: returning to the gate for a mechanical issue

Expected

An exact path (no glob characters) that matches no file is an error that names the manifest and the path, e.g. demo/mcpp.toml: [target.'cfg(not(os = "emscripten"))'.build] sources: "src/target/unix/target.cppm" matched no file. This is the same check scan_overrides already makes ("matched no source file", #902). A glob that matches nothing could stay as it is, or be a warning.

Activity

  1. speak-agent commented on Nov 16, 2026

    @speak-agent
    Member

    Fixed in mcpp 2026.11.16.1 (#940): a source named by its path that matches no file is an error in an editable tree and a warning in a fetched package, naming its table.

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