TL;DR
pixi run mojo build hello.mojo fails with “unable to find suitable c++ compiler for linking” even though
- pixi run mojo hello.mojo (interpreted mode) works, and
- activating the env and running mojo build hello.mojo works.
Adding [activation.env] with explicit CC/CXX pointing at Homebrew LLVM did not resolve the failure.
Question
I’m curious why does pixi run mojo build fail to detect a compiler while:
- pixi run mojo and
- mojo build inside an activated pixi shell
both succeed?
Although I am able to run the mojo programs, I hope to gain a deeper understanding of how mojo build works under the hood. Thank you so much!
Environment
- macOS (Darwin 24.x, arm64)
- Mojo / MAX 25.4 via Modular channel
- Pixi 0.34+
- pixi.toml (minimal repro):
[workspace]
name = "my-first-mojo-project"
channels = ["https://conda.modular.com/max", "conda-forge"]
platforms = ["osx-arm64"]
version = "0.1.0"
[dependencies]
max = "==25.4"
Reproduction
Add hello.mojo
to the project root directory:
def main():
print("Hello, world!")
pixi run mojo hello.mojo
pixi run mojo build hello.mojo
For comparison, below succeeds:
pixi activate
mojo build hello.mojo