That's unusual that you struggled to build Lua. Lua is primarily C89, and used on non-POSIX microcontrollers for example. There are some optional bits of the standard library you would have to leave out - module loading uses dlopen(). This is done simply by defining the right feature macros for your target environment: https://www.lua.org/source/5.4/luaconf.h.html
You may also be interested in this project: https://github.com/fengari-lua/fengari
I've used fengari and it's a great option for lua in the browser, but it is quite slow.
setjmp/longjmp are irritating to implement and used by the pcall machinery