Skip to content

Fix macos build#111

Open
ognian- wants to merge 16 commits into
mainfrom
fix-macos-build
Open

Fix macos build#111
ognian- wants to merge 16 commits into
mainfrom
fix-macos-build

Conversation

@ognian-

@ognian- ognian- commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

This adds a Github CI action for macOS, and fixes some building issues.

@ognian- ognian- requested a review from matsen February 13, 2026 13:59
@ognian-

ognian- commented Feb 13, 2026

Copy link
Copy Markdown
Contributor Author

@matsen Can you try if this branch fixes the build on your macOS? It's not including the BCR code, I'll make another action with libtorch if this succeeds.

@matsen

matsen commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

🤖 Tested on macOS — build succeeds, no regressions.

Environment

CPU Apple M2 Max (arm64, T6020)
OS macOS 15.7.3 (Darwin 24.6.0)
Compiler Apple clang 17.0.0 (clang-1700.6.3.2), target arm64-apple-darwin24.6.0
CMake 4.2.0
Generator Ninja 1.13.2

Build

cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_USHER=no -DUSE_NETAM=no .. -G Ninja
ninja -j16

All 109/109 targets compiled successfully with no errors. Only benign linker warnings:

ld: warning: ignoring duplicate libraries: '-lz'

All four executables were produced: larch-test, larch-dagutil, larch-dag2dot, bcr-larch.

Tests (non-slow, run individually)

Ran every non-slow test (89 tests) one at a time on both main and this PR branch. Results are identical — no regressions introduced by this PR.

PR branch main
Pass 55 55
Fail (exit 1) 8 8
Segfault (exit 139) 26 26

The 26 segfaults and 8 assertion failures are all pre-existing on main and appear to be related to running the mock (USE_USHER=no) build on macOS/arm64 — they are not caused by this PR. The exact same test IDs pass and fail on both branches.

Passing tests include: DAG loader, overlay, compact genome, sample tree, RF distance, parsimony, weight accumulator, weight counter, S5F likelihood, Sankoff (all 4), SPR (4 of 7), merge (0 of 5), netam kmer/model/likelihood, mat conversion, mat view, parallel, UA-free parsimony, and more.

@ognian-

ognian- commented Feb 17, 2026

Copy link
Copy Markdown
Contributor Author

@matsen It should be buildable with BCR and libtorch too: easiest should be to activate the conda environment environment-dev-macos-netam.yml

If it builds for you we can merge.

@matsen

matsen commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

🤖

Build test on macOS Apple Silicon (M-series, macOS 15.5 Sequoia, AppleClang 17.0)

Compilation: PASS

  • Mock build (USE_USHER=no): Compiles cleanly
  • Full build (with usher): Compiles cleanly
  • Only warnings: ld: warning: ignoring duplicate libraries: '-lz' (benign)

Tests: 86/89 non-slow tests pass

The 3 failures are pre-existing on main (not introduced by this PR):

  • [15] Load dagbin: Sample DAG (Read-only) — dagbin section_endpos assertion
  • [19] Load dagbin: test_5_trees, 3 iters, seeded — dagbin/protobuf mismatch
  • [36] MATConversion: Check SampleIds — leaf sample ID check failure

Protobuf caveat

Initial builds segfaulted on every protobuf parse operation. Root cause: homebrew protobuf 29.3 has a bug in TcParser::AddMessage on Apple Silicon. After upgrading to protobuf 33.4 (brew upgrade protobuf), all protobuf operations work correctly. This affects main equally — not a PR issue.

Conda environment: Does not resolve on arm64

The environment-dev-macos.yml tries to install openmpi-mpicc/openmpi-mpicxx which pull in clangxx_osx-64 — x86-only compiler packages. This needs to be fixed for Apple Silicon. The homebrew-based build works fine though.

BCR + libtorch build: Not tested

  • No libtorch installed on this machine
  • The conda env (which would provide pytorch-cpu) doesn't resolve on arm64
  • The cmake --preset macos-arm64-bcr preset requires a CMakePresets.json that doesn't exist on this branch

Recommendations

  1. The conda env files need arm64-compatible packages (openmpi-mpicc/openmpi-mpicxx pull in x86-only compilers)
  2. If the macos-arm64-bcr preset was intended, CMakePresets.json is missing from the PR
  3. Worth noting the protobuf ≥33.4 requirement somewhere — users with homebrew protobuf 29.3 will hit segfaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants