Hey Claude,

I finally got a chance to check into compiling this. I did have a "small" problem with getting the Lua sources using the Makefile, as the Mac does appear to have wget. I got it manually and everything was fine after that.

So, I got it compiled against the 41.4 version of Vanilla PD. But when I try to run it using the following:

/Applications/Pd-0.41-4.app/Contents/Resources/bin/pd -path src -lib lua

and I create a blank patch, then instantiate a [lua] object, it says that it can't create it...

I then restarted PD, and opened one of the example patches in the 'src' directory (lua-help.pd), and it produces this error:

error: lua: error loading `pd.lua': canvas_open() failed
error: lua: loader will not be registered!
 lua
... couldn't create
 luax hello
... couldn't create
 hello
... couldn't create

I then tried again to instantiate a [lua] object, and it produced this error message:

lua: already loaded
 lua
... couldn't create

So, can I assume that PD IS finding the Lua external, but something is preventing it from finishing loading, and instantiating an object?

I am running Mac OS X 10.4.11. Also, doesn't the liblua.a file need to be in a special place? Is it possible that it is looking for the wrong library file, as I already do have another liblua.a installed (the default one from Apple).

Here is the output from the run of Make:

tar xzf lua-5.1.3.tar.gz
touch lua-5.1.3/unpack.stamp
make -C lua-5.1.3 macosx local
cd src && make macosx
make all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lapi.o lapi.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lcode.o lcode.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o ldebug.o ldebug.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o ldo.o ldo.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o ldump.o ldump.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lfunc.o lfunc.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lgc.o lgc.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o llex.o llex.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lmem.o lmem.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lobject.o lobject.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lopcodes.o lopcodes.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lparser.o lparser.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lstate.o lstate.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lstring.o lstring.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o ltable.o ltable.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o ltm.o ltm.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lundump.o lundump.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lvm.o lvm.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lzio.o lzio.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lauxlib.o lauxlib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lbaselib.o lbaselib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o ldblib.o ldblib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o liolib.o liolib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lmathlib.o lmathlib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o loslib.o loslib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o ltablib.o ltablib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lstrlib.o lstrlib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o loadlib.o loadlib.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o linit.o linit.c
ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o
ranlib liblua.a
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o lua.o lua.c
gcc -o lua  lua.o liblua.a -lm -lreadline
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o luac.o luac.c
gcc -O2 -Wall -DLUA_USE_LINUX   -c -o print.o print.c
gcc -o luac  luac.o print.o liblua.a -lm -lreadline
make install INSTALL_TOP=..
cd src && mkdir -p ../bin ../include ../lib ../man/man1 ../share/lua/5.1 ../lib/lua/5.1
cd src && install -p -m 0755 lua luac ../bin
cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp ../include
cd src && install -p -m 0644 liblua.a ../lib
cd doc && install -p -m 0644 lua.1 luac.1 ../man/man1
touch lua-5.1.3/build.stamp
gcc -ansi -pedantic -Wall -O2 -fPIC -Ilua-5.1.3/include/ -I/Applications/Pd-0.41-4.app/Contents/Resources/src -bundle -undefined suppress -flat_namespace -o src/lua.pd_darwin src/lua.c lua-5.1.3/lib/liblua.a 


I tried to follow this through, and track which makefiles it is using, but kind of got lost when 'LUA_USE_LINUX' appears...

Any ideas?


Thanks,

Mike


--
Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal.
—Yehudi Menuhin (1916–1999), musician