Skip to content

fix: make Lua SYSLIBS platform-conditional for macOS compatibility - #33

Open
cyclingwithelephants wants to merge 1 commit into
telent:mainfrom
cyclingwithelephants:fix/macos-lua-linker-flag
Open

fix: make Lua SYSLIBS platform-conditional for macOS compatibility#33
cyclingwithelephants wants to merge 1 commit into
telent:mainfrom
cyclingwithelephants:fix/macos-lua-linker-flag

Conversation

@cyclingwithelephants

Copy link
Copy Markdown

Fixes #32

Problem

The Lua 5.3 build in overlay.nix hardcodes -Wl,-E (GNU ld's --export-dynamic), which Apple's ld64 rejects with ld: unknown option: -E. This cascades to fail the doc build and anything else that transitively depends on Lua.

Fix

Make the flag platform-conditional — macOS dyld handles dynamic symbol visibility differently and doesn't need -Wl,-E:

- makeFlagsArray+=(PLAT="posix" SYSLIBS="-Wl,-E -ldl" ...)
+ makeFlagsArray+=(PLAT="posix" SYSLIBS="${if final.stdenv.isDarwin then "" else "-Wl,-E "}-ldl" ...)

The hardcoded -Wl,-E linker flag is GNU ld specific (--export-dynamic)
and is rejected by Apple's ld64 with 'ld: unknown option: -E'.

This causes the Lua 5.3 build to fail on macOS, which cascades to
everything that depends on it (kyua, lutok, atf, doc build, etc).

macOS dyld handles dynamic symbol visibility differently and does not
need -Wl,-E, so the flag is now passed only on non-Darwin platforms.
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 build broken: hardcoded -Wl,-E linker flag in Lua overlay

1 participant