How to compile Lua 5.3.0 as a Mac OS X dynamic library

Thursday, January 22nd, 2015 | Dennis D. Spreen | Lua, Mac OS X

This is a tutorial on how to compile Lua 5.3.0 as a Mac OS X universal fat dynamic library (liblua.dylib).

This tutorial on how to compile Lua as a Mac OS X dynamic library resulting in a liblua5.3.0.dylib is based on the instructions provided by Adrian Perez – thank you!

1. download and build Lua as stated in the Lua FAQ but as a universal binary:

2. add a new dynamic build rule to the src/makefile and build the library with

See Frameworks and Binding for information about the install_name.
You’re done! You should now have a lua interpreter, a luac compiler and a liblua5.3.0.dylib.

Tags: ,

2 Comments to How to compile Lua 5.3.0 as a Mac OS X dynamic library

Jordan
March 18, 2015

I am following this for Lua version 5.0 (lua5_0_3_Sources.tar.gz), and everything works wonderfully until the very last step. I have renamed and double checked all references to liblua5.3.0 to liblua50 and version 5.0.3, but when I do ‘make -C src liblua50.dylib’ I get the following output:

cc -dynamiclib -o liblua50.dylib -arch i386 -arch x86_64 -compatibility_version 5.0.3 -current_version 5.0.3 -install_name @rpath/liblua50.dylib
clang: error: no input files
make: *** [liblua50.dylib] Error 1

I’m pretty new to this whole thing, and I’m not terribly sure what I’m doing wrong. If you could give a novice a hand I would be very grateful 🙂

Dennis D. Spreen
March 19, 2015

this is a tutorial for Lua 5.3.0 NOT Lua 5.0.3 😉

Leave a comment

About Dennis D. Spreen

I'm an avid programmer working on a variety of platforms in a variety of languages with a wide technical interest.

Search

QR Code

Categories