pd-lua icon indicating copy to clipboard operation
pd-lua copied to clipboard

Bug: lua_gc Function Called with Incorrect Number of Parameters

Open Va16hav07 opened this issue 10 months ago • 4 comments

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:

  1. Clone the Purr Data repository
  2. Run make to build the project
  3. 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
[Image

System Information:

  • OS: Ubuntu 22.04
  • Purr Data Version: 2.19.4
  • Compiler: Default (make all)

Va16hav07 avatar Feb 19 '25 18:02 Va16hav07

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?

agraef avatar Feb 19 '25 20:02 agraef

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.

Va16hav07 avatar Feb 20 '25 04:02 Va16hav07

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)?

umlaeute avatar Aug 18 '25 14:08 umlaeute

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

pd-lua/README

Lines 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 do git submodule update --init instead. 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

Va16hav07 avatar Aug 19 '25 17:08 Va16hav07