luarocks install lua-resty-aws failed on Mac OS
Nov 1, 2023
I got following error when I was trying to install the lua-resty-aws
in MacOS(M2 chip)
luaexpat 1.5.1-1 depends on lua >= 5.1 (5.4-1 provided by VM)
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/lxplib.c -o src/lxplib.o -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Isrc/
src/lxplib.c:12:10: fatal error: 'expat_config.h' file not found
#include "expat_config.h"
^~~~~~~~~~~~~~~~
1 error generated.
Error: Failed installing dependency: https://luarocks.org/luaexpat-1.5.1-1.src.rock - Build error: Failed compiling object src/lxplib.o
How to solve:
- Check if you have installed the
expat
in your local. If yes, skip this step, otherwise install via homebrew for instance.
$ HOMEBREW_NO_AUTO_UPDATE=1 brew install expat
2. Get the expat
installation path
$ brew info expat
# My case is /opt/homebrew/Cellar/expat/2.5.0
3. Install again
$ luarocks install lua-resty-aws EXPAT_DIR=/opt/homebrew/Cellar/expat/2.5.0
Hope this will be helpful to you ๐