Skip to content

Fix macOS arm64 builds: add SIMD guard and qd archive rebuild#42

Open
shauryasingh310-ops wants to merge 1 commit into
GeomScale:developfrom
shauryasingh310-ops:fix/macos-arm64-build
Open

Fix macOS arm64 builds: add SIMD guard and qd archive rebuild#42
shauryasingh310-ops wants to merge 1 commit into
GeomScale:developfrom
shauryasingh310-ops:fix/macos-arm64-build

Conversation

@shauryasingh310-ops
Copy link
Copy Markdown

Fix macOS arm64 builds: header ordering, SIMD guard, and qd archive rebuild

Resolves macOS Apple Silicon (arm64) build failures that occur when system lp_solve headers or stale qd artifacts exist.

Changes:

  1. Add ARM64 guard for x86 SIMD intrinsics (src/external/PackedCSparse/FloatArray.h)

    • Wrap #include <immintrin.h> with #ifdef __x86_64__ to prevent compilation errors on ARM64
  2. Force qd archive rebuild for correct architecture (src/external/PackedCSparse/qd/Makefile)

    • Remove -march=native flag (prevents architecture-specific optimization)
    • Add clean dependency to libqd.a target to ensure rebuild with correct architecture
    • Prevents reusing stale x86_64 binaries when building on arm64
  3. Prioritize vendored headers (src/Makevars, src/Makevars.win)

    • Header include order already correct (vendored paths before system paths)

Result: R CMD INSTALL . now succeeds on macOS arm64 even if system lp_solve is installed or tree was previously built under different architecture.

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.

1 participant