Compiling ocaml-lua under OSX

Hi all, I’m here to asking some help. I recently submitted a new minor version of ocaml-lua, the binding of the Lua library and language for OCaml. The release is very simple, it’s only an update to make compatible with the latest version of OCaml.

It fails to build on OSX: https://github.com/ocaml/opam-repository/pull/12888

I don’t have an OSX machine since years. Is there anyone with a Mac and homebrew that can try to compile it and tell me what’s going wrong? The release file is this: https://github.com/pdonadeo/ocaml-lua/archive/v1.7.tar.gz

Thanks in advance.

:ocaml-lua-1.7 $ ./configure 
FAILED TO COMPILE TEST PROGRAM. MESSAGE IS:
================================================================================
COMMAND "cc /tmp/ocaml-lua_build_95fd05.c -O2 -fno-strict-aliasing -fwrapv -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O3 -Wall -Isrc/ -I/usr/local/include/lua-5.1 -c" FAILED WITH STATUS 1. OUTPUT WAS:
-------------------
/tmp/ocaml-lua_build_95fd05.c:3:10: fatal error: 'lua.h' file not found
#include "lua.h"
         ^~~~~~~
1 error generated.
================================================================================
E: Failure("Command './post_conf.ml' terminated with error code 1")

At least on my macOS machine, I have Lua 5.3 and the headers are in /usr/local/include/lua5.3. So -I/usr/local/include/lua-5.1 above could be a reason that this fails.

Thanks but that behaviour is the right one in this case because the binding is specifically to Lua 5.1.x.

Is there an homebrew package named lua51?

After installing brew install lua@5.1: this works for me:

  • configure
  • make
  • make test after ocaml setup.ml -configure --enable-tests

So the mystery remains… lua51 is specified in the depexts of the opam file.

Thanks @lindig, at least I know that something horribly wrong is not the issue here.