Skip to content

scripts/build.sh / make fail under the Nix flake dev shell on macOS; cross-arch builds unsupported #705

Description

@kriswill

Version

codebase-memory-mcp dev (built from source, main @ 7824e50)

Platform

macOS (Apple Silicon)

Install channel

Built from source

Binary variant

standard

What happened, and what did you expect?

In the Nix flake dev shell (nix develop) on macOS, scripts/build.sh aborts before compiling anything: it prints WARNING: clang (…) is x86_64 only — cannot build native arm64 and exits 1 — even though the Nix clang targets arm64-apple-darwin natively and builds fine. I expected scripts/build.sh (the "Build from Source" flow in CONTRIBUTING) to produce build/c/codebase-memory-mcp. The same false negative hits test.sh/lint.sh/repro.sh (shared scripts/env.sh).

Separately, a cross-architecture build (scripts/build.sh --arch x86_64) does not produce an x86_64 binary, and once the compiler check is bypassed the build fails to compile with unknown type name 'git_allocator'.

nix build works only because the flake's buildPhase already bypasses build.sh and calls make directly (with a comment acknowledging the file-check failure), so this is specific to the documented developer workflow, not the packaged build.

Reproduction

Public repo: this repository (DeusData/codebase-memory-mcp @ main). Host: macOS, Apple Silicon. Toolchain: nixpkgs clang-wrapper 21.x in the flake dev shell (CC=clang CXX=clang++); clang --versionTarget: arm64-apple-darwin.

  1. nix develop
  2. scripts/build.sh
    • Actual: aborts with WARNING: clang (…) is x86_64 only — cannot build native arm64, exit 1.
    • Expected: builds build/c/codebase-memory-mcp (native arm64).
  3. Cross-arch: scripts/build.sh --arch x86_64
    • Actual: no working x86_64 binary (compiler check, then link failure — see Logs).
  4. Bypass the check the way the flake does — make -f Makefile.cbm cbm:
    • Actual: compile error internal/cbm/cbm.c:347: unknown type name 'git_allocator' (only when libgit2 is on the pkg-config path, i.e. inside the Nix shell).

Logs

# 1) scripts/build.sh
=== build.sh: os=darwin arch=arm64 cores=10 cc=clang cxx=clang++ ===
  ui=false version=dev
WARNING: clang (/nix/store/…-clang-wrapper-21.x/bin/clang) is x86_64 only — cannot build native arm64
  Install arm64 GCC: arch -arm64 /opt/homebrew/bin/brew install gcc
  Or override: scripts/test.sh --arch x86_64
# exit 1

# 2) cross-arch link (after the arch check is satisfied)
ld: warning: ignoring file …/zlib-1.3.2/lib/libz.dylib, building for macOS-x86_64 but … arm64
ld: warning: ignoring file …/libgit2-1.9.4/lib/libgit2.dylib, building for macOS-x86_64 but … arm64
Undefined symbols for architecture x86_64
ld: symbol(s) not found for architecture x86_64

# 3) make -f Makefile.cbm cbm
internal/cbm/cbm.c:347:12: error: unknown type name 'git_allocator'
  347 |     static git_allocator cbm_git_alloc = {
      |            ^

Diagnostics trajectory (memory / performance / leak issues)

N/A — build/toolchain bug, not a memory or performance issue.

Project scale (if relevant)

N/A

Confirmations

  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a public OSS repository — this repo itself).

Activity

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

    bugSomething isn't workingpriority/normalStandard review queue; useful PR with ordinary maintainer urgency.ux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions