Skip to content

Skip redundant luaL_setfuncs when linking against LuaJIT - #197

Open
jucardi wants to merge 1 commit into
Lua-cURL:masterfrom
jucardi:fix/luajit-setfuncs
Open

Skip redundant luaL_setfuncs when linking against LuaJIT#197
jucardi wants to merge 1 commit into
Lua-cURL:masterfrom
jucardi:fix/luajit-setfuncs

Conversation

@jucardi

@jucardi jucardi commented Aug 6, 2026

Copy link
Copy Markdown

Summary

When building against LuaJIT, l52util.c's local Lua 5.2-compat luaL_setfuncs shim collides with the implementation LuaJIT itself exports (LuaJIT provides the 5.2 API on 5.1), causing a duplicate-symbol failure with static linking (observed on macOS arm64). This guards the shim with #ifndef LUAJIT_VERSION so LuaJIT builds use LuaJIT's own luaL_setfuncs; plain Lua 5.1 builds are unchanged.

Found while building Path of Building's SimpleGraphic host, which vendors Lua-cURLv3 as a submodule, statically against LuaJIT on macOS.

🤖 Generated with Claude Code

LuaJIT already provides luaL_setfuncs (declared in lauxlib.h, defined
in its own lib_aux.c). Defining it again here causes a duplicate
symbol at link time on platforms where LuaJIT is linked as a static
library (e.g. macOS), since the archive member providing it still
gets pulled in for other symbols. Guard the compat definition so it
only compiles for vanilla PUC Lua 5.1, which lacks the symbol.
jucardi added a commit to jucardi/PathOfBuilding-SimpleGraphic that referenced this pull request Aug 6, 2026
Revert the luautf8 and Lua-cURLv3 submodule pointers to their upstream
commits and replace the in-submodule fixes with equivalents in this
repo's build:
- lua-utf8: force-include <limits.h> on non-Windows (INT_MAX use)
- lcurl: rename its local Lua 5.2-compat luaL_setfuncs shim on
  non-Windows to avoid a duplicate symbol against static LuaJIT

The proper fixes are PR'd upstream (starwing/luautf8#62,
Lua-cURL/Lua-cURLv3#197); once merged, bump the submodules and drop
these workarounds.
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