Skip to content

fix: create liblualib.a symlink for Lua 5.1+ installs#50

Closed
tyrro wants to merge 1 commit intoStratus3D:masterfrom
tyrro:fix/liblualib-symlink-lua-5-1-plus
Closed

fix: create liblualib.a symlink for Lua 5.1+ installs#50
tyrro wants to merge 1 commit intoStratus3D:masterfrom
tyrro:fix/liblualib-symlink-lua-5-1-plus

Conversation

@tyrro
Copy link
Copy Markdown

@tyrro tyrro commented May 5, 2026

Problem

Since Lua 5.1, liblualib was merged into liblua. Lua 5.1+ installs built from source only produce liblua.a, but older native extensions (e.g. the ruby-lua gem) still link against -llualib. This causes the build to fail:

ld: library 'lualib' not found

Solution

After copying the Lua files to the install path, create a liblualib.a → liblua.a symlink when:

  • The version is Lua 5.1 or greater (not LuaJIT — LuaJIT uses different lib naming)
  • liblua.a is present in the install's lib/ directory
  • liblualib.a does not already exist (no-op if a future release ships it again)
if [ "${lua_type}" != "LuaJIT" ] && version_5_1x_or_greater "$version"; then
  if [ -f "${install_path}/lib/liblua.a" ] && [ ! -e "${install_path}/lib/liblualib.a" ]; then
    ln -sf "${install_path}/lib/liblua.a" "${install_path}/lib/liblualib.a"
  fi
fi

This matches what package managers like Homebrew do when installing Lua.

liblualib was merged into liblua in Lua 5.1. Static libraries built from
Lua 5.1+ source only ship liblua.a, but gems like ruby-lua still link
against -llualib, causing the build to fail with 'library not found'.

Create a liblualib.a -> liblua.a symlink after install when:
- The version is Lua 5.1 or greater (not LuaJIT)
- liblua.a exists in the install's lib directory
- liblualib.a is not already present (future-safe)
@tyrro tyrro mentioned this pull request May 5, 2026
@Stratus3D Stratus3D requested a review from Copilot May 5, 2026 12:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tyrro
Copy link
Copy Markdown
Author

tyrro commented May 6, 2026

@Stratus3D the CI is failing

FAILED: lua was not properly installed reason: unable to clone plugin: fatal: Remote branch fix/liblualib-symlink-lua-5-1-plus not found in upstream origin

any suggestion to fix it?

@Stratus3D
Copy link
Copy Markdown
Owner

I'm closing this PR. See #39 (comment)

@Stratus3D Stratus3D closed this May 9, 2026
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.

3 participants