How to compile Lua 5.4.0 for Linux as a shared library

Sunday, May 24th, 2020 | Dennis D. Spreen | Linux, Lua

This is a tutorial on how to compile Lua 5.4.0 for Linux as a shared library.

This tutorial on how to build Lua for Linux is based on the Stack Overflow question Compiling Lua create .so files? and the answers by @dcarrith and @simonemainardi  – for or a complete makefile take a look there!

This is just a quick hack to spill out a shared library therefore the make file isn’t complete in terms of clean up and testing.

1. Download and extract the Lua 5.4.0 source code

2. Edit the src/makefile and add the last line shown below “$(CC) -shared..” directly under the “$(RANLIB) $@” line. Be sure to use TAB for spacing!

3. Open a terminal, navigate to the base folder and run

You should now have a liblua5.4.0.so shared library in the src/ folder.

Tags: , , , ,

No comments yet.

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