New Issue: [Bug]: Mason does not build prereqs or collect chplFlags for git dependencies

28556, "ShreyasKhandekar", "[Bug]: Mason does not build prereqs or collect chplFlags for git dependencies", "2026-03-19T19:10:12Z"

Summary of Problem

Description:
When a Mason package has C/C++ prerequisites (in a prereqs/ directory with a Makefile), those prerequisites are correctly built and their printchplflags output is passed to the Chapel compiler for registry/source dependencies, but this is entirely skipped for git dependencies.

This means any library package that uses C/C++ interop via the prereqs/ mechanism will fail to link when consumed as a git dependency (git = "..." in Mason.toml), producing "Undefined symbols" or "Could not find C function" errors.

Root cause: In tools/mason/MasonBuild.chpl:

  • getSrcCode() calls MasonPrereqs.install() and MasonPrereqs.prereqs() for source/registry deps — git deps are handled separately in getGitCode() which has no prereq support at all.
  • compileSrc() calls MasonPrereqs.chplFlags(depDir) for source deps, but for git deps only the .chpl source file is added to the compilation command — no chplFlags collection happens.

Expected behavior: getGitCode() should install prereqs (call MasonPrereqs.install()), and compileSrc() should collect chplFlags for git dependencies, just as it does for source/registry dependencies.

Is this issue currently blocking your progress?
Yes.
Any library using C/C++ prereqs is broken when consumed via git dependencies, which is a common pattern for packages not yet in the Mason registry. This applies to the newly minted Parquet mason library.

The consuming application can work around this by adding its own prereqs/ directory with a Makefile that delegates to the git dependency's prereqs Makefile. Since Mason does process prereqs for the root project, this effectively proxies the missing functionality. However, this is fragile and shouldn't be necessary.

Steps to Reproduce

Create a library package with a C prereq:

# Library: GitPrereqLib
# Mason.toml
[brick]
name="GitPrereqLib"
version="0.1.0"
chplVersion="2.7.0"
license="None"
type="library"
source="https://github.com/test/GitPrereqLib"

[dependencies]

// prereqs/some-c-lib/hello.h
void hello(void);
// prereqs/some-c-lib/hello.c
#include <stdio.h>
#include "hello.h"
void hello(void) {
  printf("Hello from C prereq!\n");
}
# prereqs/some-c-lib/Makefile
all:
    gcc -c -fPIE hello.c

printchplflags:
    @$(info prereqs/some-c-lib/hello.h prereqs/some-c-lib/hello.o)

clean:
    rm -f hello.o
// src/GitPrereqLib.chpl
module GitPrereqLib {
  extern proc hello();
  proc greet() {
    hello();
  }
}

Next, create a consumer app that depends on it via git:

# App: git_prereq_app
# Mason.toml
[brick]
name="git_prereq_app"
version="0.1.0"
chplVersion="2.7.0"
license="None"
type="application"
source="https://github.com/test/git_prereq_app"

[dependencies]
GitPrereqLib = { git = "file:///path/to/GitPrereqLib" }
// src/git_prereq_app.chpl
module git_prereq_app {
  use GitPrereqLib;
  proc main() {
    greet();
  }
}

Compile and Run

mason run --build

Associated Future Test(s):

Configuration Information

  • Output of chpl --version: chpl version 2.8.0 (built with LLVM version 19.1.3)