Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTBFS On FreeBSD #17

Open
SlySven opened this issue Jan 22, 2024 · 1 comment
Open

FTBFS On FreeBSD #17

SlySven opened this issue Jan 22, 2024 · 1 comment

Comments

@SlySven
Copy link

SlySven commented Jan 22, 2024

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:

  • things are generally located in /usr/local rather than /usr
  • the default complier is clang rather than gcc
  • FreeBSD supports multiple Lua versions at once - and they are distinguished by a numeric suffix and Lua 5.1 which I am using is not the default

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
Copy link
Author

SlySven commented Jan 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant