Skip to content

Fix module mode linking on macOS#697

Open
ChrisJefferson wants to merge 1 commit intomlua-rs:mainfrom
ChrisJefferson:fix-macos-module-linking
Open

Fix module mode linking on macOS#697
ChrisJefferson wants to merge 1 commit intomlua-rs:mainfrom
ChrisJefferson:fix-macos-module-linking

Conversation

@ChrisJefferson
Copy link
Copy Markdown

When building a Lua C module (cdylib with the module feature) on macOS, the linker fails with undefined symbols for the Lua API. This is because macOS requires explicit -undefined dynamic_lookup to allow unresolved symbols in shared libraries — unlike Linux which permits them by default.

The build script already had platform-specific handling for Windows (raw-dylib linking). This adds the equivalent for macOS, passing the required linker flags so that Lua symbols are resolved at load time from the host interpreter.

Fixes the issue reported in #625 -- I didn't find that PR until after I fixed it because it's closed, do you mind putting it in the source?

When building a Lua C module (cdylib with the `module` feature) on
macOS, the linker fails with undefined symbols for the Lua API. This
is because macOS requires explicit `-undefined dynamic_lookup` to
allow unresolved symbols in shared libraries — unlike Linux which
permits them by default.

The build script already had platform-specific handling for Windows
(raw-dylib linking). This adds the equivalent for macOS, passing the
required linker flags so that Lua symbols are resolved at load time
from the host interpreter.

Fixes the issue reported in mlua-rs#625.
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