RobKohr
RobKohr

Reputation: 6953

Using the brew install of lua, make file can't find lua.h

I am trying to install lalarm from here: https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/

I installed lua on a macOS using brew install lua

and when I go to the library directory to make it, this is what happens

%> make
gcc -std=c99 -Wall -Wextra -Wfatal-errors -O2 -I/usr/local/include -o alarm.so -bundle -undefined dynamic_lookup lalarm.c 
lalarm.c:12:10: fatal error: 'lua.h' file not found
#include "lua.h"
         ^~~~~~~
1 error generated.

Where does homebrew install the lua.h file?

How do I get that to be recognized by default from make?

Upvotes: 3

Views: 1425

Answers (1)

chenrui
chenrui

Reputation: 9886

lua.h is not in /usr/local/include:

$ fd lua /usr/local/include
$ 

You need to configure the CFLAGS to include /opt/homebrew/Cellar/lua/5.4.4_1/include/lua:

$ fd lua.h /opt/homebrew/Cellar/lua/5.4.4_1
/opt/homebrew/Cellar/lua/5.4.4_1/include/lua/lua.h
/opt/homebrew/Cellar/lua/5.4.4_1/include/lua/lua.hpp
/opt/homebrew/Cellar/lua/5.4.4_1/include/lua5.4/lua.h
/opt/homebrew/Cellar/lua/5.4.4_1/include/lua5.4/lua.hpp

Upvotes: 3

Related Questions