Repository navigation
Description
Hi Leafo π π
So I just can't get this lib to build on arch linux for the life of me. I was able to get it going on macos, though [γ)_/Β―
Please just close this if I'm the problem or if this is a dupe. But in my research tonight, I believe I am not the only one.
Currently as I see it, https://github.com/wahern/luaossl appears unmaintained, 13 pull requests open, no updates in 3 years, and better options may be out there?
Here this guy tried Lua both 5.3, 5.4, OpenSSL 3.5 and I tried Luajit with Both 3.5 and 1.1.
I did manage to get it to build with luajit, but only after jumping through quite a few hoops, so I was surprised to test my app on linux and run in to trouble - usually other way around. If it matters, here is how I got it working on mac:
export LUA_VERSION=5.1
export LUA_DIR=/opt/homebrew/opt/openresty/luajit
export PATH="$LUA_DIR/bin:$HOME/bin:$PATH"
export LAPIS_OPENRESTY="/opt/homebrew/bin/openresty"
export CRYPTO_DIR="/opt/homebrew/opt/openssl@3"
export CRYPTO_LIBDIR="$CRYPTO_DIR/lib"
export CRYPTO_INCDIR="$CRYPTO_DIR/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
# with lua symlinked to luajit and front of my PATH
# + with luarocks compiled from source in the above environment and again put on path front
# finally I can cd to lapis and do this:
eval "$(luarocks --lua-version=5.1 --tree=lua_modules path)
luarocks make --only-deps --tree=lua_modules $PROJECT-0.1-1.rockspec \
CRYPTO_INCDIR=/opt/homebrew/opt/openssl@3/include \
CRYPTO_LIBDIR=/opt/homebrew/opt/openssl@3/lib \
OPENSSL_INCDIR=/opt/homebrew/opt/openssl@3/include \
OPENSSL_LIBDIR=/opt/homebrew/opt/openssl@3/lib
# with lapis listed in my dependencies among other things, it builds
The luaossl issue tracker is choke full of people struggling to build.
I don't mean to be a downer, i love lapis so much and have had SO MUCH FUN building things with it, and I hate web dev.
A quick search, I found https://github.com/zhaozg/lua-openssl and https://github.com/lunarmodules/luasec and I'm also wondering how much lift it would be to make the switch to one of these? I don't mean to create a bunch of work, but maybe it needs to be done? If it's already on the map, again sorry.
Trying to figure out how to save other people some time. This already sunk my night. π If there's a straight forward path to buildling lapis without ssl deps ...
(I already tried a couple hacks, couldn't get it to go after purging luaossl and some modules I think were depending on it, it ended up going back to utf8 stuff I think and I gave up, decided the better path might be to just switch ssl libs in the lapis codebase...),
...i'd be open to that too, because i think we could just fall back to using libcurl or something?
Cheers π»
Related issues in lapis open status: #632 #766 #783
and closed: #799 #698 #688 #667 #612 #595 #576 #560 #545 #539
Activity
jprjr commentedon Jun 30, 2025
Hi there - just wanted to mention, I believe I've found the ultimate cause of the compile error and a workaround:
You could probably also use
-std=c99in place of-std=gnu99- I'm not sure ifgnu99is really needed. The main point is to force GCC 15+ to not use C23. Once the rock is installed you should be able to install lapis normally.I have details in some comments on luaossl#220
a-schaefers commentedon Oct 8, 2026
the report was accurate when it was filed, and upstream has since fixed most of it. GCC 15+ compiles C23 by default, and luaossl 20220711 didn't build under C23. I reproduced the exact errors from luaossl#220. luaossl fixed its side in 20250929. OpenSSL fixed a second culprit in its
ocsp.hheader in 3.0.19, 3.4.4, 3.5.5, 3.6.1 and 4.0. On an Arch-equivalent toolchain (C23 with OpenSSL 3.6.5),luarocks install lapisnow succeeds.What still holds:
lapis/util/encoding.moon:5,lapis/csrf.moon:4), so every app needs it, even on OpenResty wherengx.hmac_sha1does the signing.a-schaefers commentedon Oct 12, 2026
From here, when wahern/luaossl#222 is merged upstream, this impacts in the following ways:
What src/openssl.c: avoid PEM_write_bio_OCSP_RESPONSE() to fix C23 buildsΒ wahern/luaossl#222 fixes: with it, luaossl builds under GCC 15βs default C23 against any OpenSSL. Before, it failed with any OpenSSL that still had the old cast: Ubuntu 25.10βs 3.5.3, and all of 1.1.1, 3.1 and 3.2. The earlier C23 breakage was already fixed in luaossl 20250929.
It only reaches users after a release. luarocks install lapis pulls the published luaossl rock, so nothing changes for users until wahern merges #222 and publishes a new release. Until then, the docs workaround in leafo/lapis#821 (CFLAGS="-std=gnu17") is what helps.
a-schaefers commentedon Oct 13, 2026
#821 closed, This PR wasoverkill, things are being fixed upstream in wahern/luaossl#222 this and will flow naturally resolved in to lapis.
CFLAGS="-O2 -fPIC -std=gnu17"can help people hitting the edge case during this inbetween time and it being documented here in the github issue is enough.a-schaefers commentedon Oct 13, 2026
So once #222 is released, #820 also isnβt needed for #802. It only has value as a step toward leafo dropping the hard dependency, which nobody has asked for. Thus closing.
a-schaefers commentedon Oct 13, 2026
With the merging of wahern/luaossl#222
AND
documentation of
CFLAGS="-O2 -fPIC -std=gnu17"
and
CC="gcc -std=gnu99" luarocks install luaossl
workarounds discussed here in this issue thread,
this entire issue can be closed. Cheers π»