Skip to content

Fix lua5.5 on Linux and macOS#10

Open
cclauss wants to merge 1 commit into
masterfrom
lua5.5_on_linux_and_macos
Open

Fix lua5.5 on Linux and macOS#10
cclauss wants to merge 1 commit into
masterfrom
lua5.5_on_linux_and_macos

Conversation

@cclauss

@cclauss cclauss commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Fixes: bastibe#100

lua5.5 tests/test_py.lua # fails...

The tests pass on lua5.1 and lua5.3 but fail on lua5.5 with:

lua5.5: error loading module 'python' from file './python.so':
	./python.so: undefined symbol: luaL_openlibs

https://github.com/bastibe/lunatic-python/blob/26d0ac7563eeedc22fb04f103e3d16cebe382f5d/src/luainpython.c#L586

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make the project work reliably with Lua 5.5 on Linux and macOS by adjusting build/link behavior, adding CI coverage, and improving test execution via pytest/doctest.

Changes:

  • Adds a GitHub Actions CI workflow to build and run Lua/Python bridge tests on Linux and macOS for Lua 5.5.
  • Updates the LuaRocks Makefile/rockspec variables and setup.py environment setup to improve library discovery/linking.
  • Refactors/extends tests by converting doctest expectations and adding a pytest-based test suite.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_lua.py Refactors doctests to be less brittle and gates some python-module interactions behind TODOs.
tests/test_lua_via_pytest.py Adds pytest equivalents of the doctest coverage (with several tests currently skipped).
setup.py Modernizes Py3 detection and sets a default PKG_CONFIG_PATH when missing.
Makefile.luarocks Adjusts macOS linker settings and introduces Lua library linking logic (currently macOS-only).
lunatic-python-scm-0.rockspec Passes LUA_LIBDIR into the Makefile build variables.
.github/workflows/ci.yml Adds CI matrix for Lua 5.5 on Linux/macOS and runs doctest, Lua tests, and pytest.

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

Comment thread Makefile.luarocks
Comment on lines +32 to +36
ifeq ($(shell uname -s),Darwin)
LDFLAGS := $(shell python3-config --embed --ldflags) $(if $(and $(LUA_LIBDIR_FILE),$(or $(LUA_LIBDIR),$(LUA_INCDIR))),$(or $(LUA_LIBDIR),$(patsubst %/include,%/lib,$(LUA_INCDIR)))/$(LUA_LIBDIR_FILE),$(if $(or $(LUA_LIBDIR),$(LUA_INCDIR)),-L$(or $(LUA_LIBDIR),$(patsubst %/include,%/lib,$(LUA_INCDIR))) -llua,))
else
LDFLAGS := $(shell python3-config --embed --ldflags)
endif
Comment on lines +8 to +11
# TODO: Remove this skip marker and fix the segmentation fault issues.
skip_segfault = pytest.mark.skip(
reason="Segmentation fault in LuaJIT when accessing table elements"
)
Comment thread .github/workflows/ci.yml Outdated
Comment on lines +42 to +44
- run: python -m doctest tests/test_lua.py || true # doctest fails on macOS 13.6, but works on macOS 14.0
- run: lua${{ matrix.lua-version }} tests/test_py.lua
- run: python -m doctest tests/test_lua.py
@cclauss cclauss force-pushed the lua5.5_on_linux_and_macos branch 3 times, most recently from d8ce3a5 to 545de80 Compare June 27, 2026 10:48
@cclauss cclauss force-pushed the lua5.5_on_linux_and_macos branch from 545de80 to 32416fd Compare June 27, 2026 10:54
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.

lua5.5 only: python.so: undefined symbol: luaL_openlibs

2 participants