Skip to content

Fix MEX compilation on macOS Apple Silicon by forcing classic linker (-ld_classic)#14

Open
MasWag wants to merge 1 commit intodecyphir:masterfrom
MasWag:master
Open

Fix MEX compilation on macOS Apple Silicon by forcing classic linker (-ld_classic)#14
MasWag wants to merge 1 commit intodecyphir:masterfrom
MasWag:master

Conversation

@MasWag
Copy link
Copy Markdown

@MasWag MasWag commented Feb 24, 2026

This PR fixes MEX compilation failures on macOS Apple Silicon (maca64) caused by recent Apple/Xcode linker behavior.

On affected systems, MEX builds fail with undefined MATLAB adapter symbols such as:

  • _mexCreateMexFunction
  • _mexDestroyMexFunction
  • _mexFunctionAdapter

The workaround is to force the classic Apple linker by appending:

'LDFLAGS=\$LDFLAGS -ld_classic'

to mex invocations on macOS arm64 only.

What this PR changes

Adds a platform-conditional workaround (ismac && strcmp(computer('arch'),'maca64')) to MEX build paths, including:

  • InstallBreach.m
  • @STL_Formula/private/src/robusthom/CompileRobusthom.m
  • Online/m_src/compile_stl_mex.m

and related MEX build scripts used during installation/build.

Notes

Closes #13

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.

macOS Apple Silicon (maca64): mex compilation fails due to new Apple linker (_mexCreateMexFunction undefined)

1 participant