Bug: lua_gc Function Called with Incorrect Number of Parameters
While building Purr Data, the compilation fails due to an incorrect number of arguments passed to the lua_gc function. According to the Lua 5.3 documentation, lua_gc requires three parameters, but the current implementation passes only two.
To Reproduce
Steps to reproduce the behavior:
- Clone the Purr Data repository
- Run
maketo build the project - Observe the compilation error
Expected behavior
The lua_gc function should be called with three parameters as required by Lua 5.3 to avoid compilation errors.
Error Log
pdlua.c: In function ‘pdlua_free’:
pdlua.c:72:5: error: too few arguments to function ‘lua_gc’
lua_gc(L, what);
This suggests that the third parameter (data) is missing in the function call.
Screenshots
[
System Information:
- OS: Ubuntu 22.04
- Purr Data Version: 2.19.4
- Compiler: Default (
make all)
Hmm yes, looks like nobody really tested that code with Lua 5.3 recently.
For the time being a workaround would be to just compile against Lua 5.4. It's not necessary to install Lua 5.4 for that, pd-lua includes a lua 5.4 submodule which it compiles against if you check out that module beforehand. When compiling pd-lua as part of purr-data, make sure that you recursively check out all submodules in the purr-data source tree (git submodule update --init --recursive).
Normally running make (or make checkout) in the purr-data source tree should take care of this automatically, so I'm wondering how you ran into this bug in the first place. Which purr-data source exactly are you working with? Did you check out the purr-data git repository? How? (And which branch?) And which command exactly did you use to compile purr-data?
I built the master branch from the Git repository and followed the README instructions, which led to an issue. After cloning the repo, I ran "make all" and encountered this problem.
I built the master branch from the Git repository and followed the README instructions,
so do you have the lua submodule checked out as explained in https://github.com/agraef/pd-lua/blob/4301f744a9023ea77b6fe0ba35918ad18e19276f/README#L160-L166
or are you referring to a different README and repo (e.g. from purr-data)?
I built the master branch from the Git repository and followed the README instructions,
so do you have the
luasubmodule checked out as explained inLines 160 to 166 in 4301f74
The repository source includes a lua submodule which can be used to compile Lua alongside pdlua, so no Lua installation is needed to compile the external. (You'll still need to have Pd installed.) Just make sure to check out the submodule with the repository (
git clone --recurse-submodules). If you already checked out the repository, you can also dogit submodule update --initinstead. This should get you a fairly recent revision of the upstream Lua source. or are you referring to a different README and repo (e.g. from purr-data)?
yeah I am talked about Purr data