Search code examples
macosluamakefileluac

Building Lua 5.0 on 64bit Mac


For compatibility/legacy reasons I need to build the Lua compiler (luac) from version 5.0, on my 64bit Intel Mac. (5.1 or later can't be used.)

Dev tools installed through Xcode 4.6's Preferences window.

After I 'cd' in to the Lua directory, I issue the command 'make'.

cd include; make all
make[1]: Nothing to be done for `all'.
cd src; make all
make[1]: Nothing to be done for `all'.
cd src/lib; make all
make[1]: Nothing to be done for `all'.
cd src/luac; make all
gcc -o ../../bin/luac  luac.o print.o lopcodes.o -L../../lib -llua -llualib -lm
Undefined symbols for architecture x86_64:
  "_UNUSED", referenced from:
      _writer in luac.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [../../bin/luac] Error 1
make: *** [all] Error 2

I do not know how to configure the make process for x86_64. Could someone please step me through it?

Thanks.


Solution

  • It works for me, but the output below is different from yours:

    ...
    cd src/luac; make all
    gcc -O2 -Wall -I../../include -I..      -c -o luac.o luac.c
    gcc -O2 -Wall -I../../include -I..      -c -o print.o print.c
    gcc -o lopcodes.o -c -O2 -Wall -I../../include -I..    -DLUA_OPNAMES ../lopcodes.c
    gcc -o ../../bin/luac  luac.o print.o lopcodes.o -L../../lib -llua -llualib -lm 
    cd src/lua; make all
    gcc -O2 -Wall -I../../include      -c -o lua.o lua.c
    

    Try make clean all at the top level first.