brimworks / lua-yajl

Integrate the yajl JSON library with Lua.
48 stars 10 forks source link

FTBFS On FreeBSD #17

Open SlySven opened 7 months ago

SlySven commented 7 months ago

It is not possible to build this as a Luarock on FreeBSD (I am using 13.2-RELEASE).

I instead cloned the repository but also found that it Failed To Build From Source. I think this is because:

OTOH I did manage to build this library by making the following hacks to the current Makefile:

@@ -1,19 +1,19 @@
 # This Makefile is based on LuaSec's Makefile. Thanks to the LuaSec developers.
-# Inform the location to intall the modules
-LUAPATH  = /usr/share/lua/5.1
-LUACPATH = /usr/lib/lua/5.1
-INCDIR   = -I/usr/include/lua5.1
-LIBDIR   = -L/usr/lib
+# Inform the location of where to install the modules
+LUAPATH  = /usr/local/share/lua/5.1
+LUACPATH = /usr/local/lib/lua/5.1
+INCDIR   = -I/usr/local/include/lua51 -I/usr/local/include
+LIBDIR   = -L/usr/local/lib

 # For Mac OS X: set the system version
 MACOSX_VERSION = 10.4

 CMOD = yajl.so
 OBJS = lua_yajl.o

-LIBS = -lyajl -llua -lm
+LIBS = -lyajl -llua-5.1 -lm
 WARN = -Wall -pedantic

 BSD_CFLAGS  = -O2 -fPIC $(WARN) $(INCDIR) $(DEFS)
 BSD_LDFLAGS = -O -shared -fPIC $(LIBDIR)

@@ -22,12 +22,12 @@ LNX_LDFLAGS = -O -shared -fPIC $(LIBDIR)

 MAC_ENV     = env MACOSX_DEPLOYMENT_TARGET='$(MACVER)'
 MAC_CFLAGS  = -O2 -fPIC -fno-common $(WARN) $(INCDIR) $(DEFS)
 MAC_LDFLAGS = -bundle -undefined dynamic_lookup -fPIC $(LIBDIR)

-CC = gcc
-LD = $(MYENV) gcc
+CC = clang
+LD = $(MYENV) clang
 CFLAGS  = $(MYCFLAGS)
 LDFLAGS = $(MYLDFLAGS)

 .PHONY: all clean install none linux bsd macosx
SlySven commented 7 months ago

Fortunately the CMake build system does work - unfortunately Luarocks builds use the present Makefile directly....