Bug #7804
closedutil-lua-sandbox.c undeclared identifier error for Suricata 8.0.0
Added by Marius Schamschula about 2 months ago. Updated 24 days ago.
Description
While attempting to upgrade my local MacPorts build to version 8.0.0, I ran into the following error(s):
:info:build CC util-lua-util.o :info:build util-lua-sandbox.c:223:24: error: use of undeclared identifier 'LUA_GNAME' :info:build 223 | if (strcmp(module, LUA_GNAME) == 0) { :info:build | ^ :info:build util-lua-sandbox.c:254:7: error: use of undeclared identifier 'LUA_GNAME' :info:build 254 | { LUA_GNAME, luaopen_base }, :info:build | ^ :info:build 2 errors generated.
I'm building with th following environment
macOS 15.5 24F74 arm64 Xcode 16.4 16F6
Note: I did get a clean build and install of Suricate 7.0.11 with the same toolchain.
Updated by Victor Julien about 2 months ago
- Target version changed from 8.0.0 to 8.0.1
- Affected Versions 8.0.0 added
Updated by Philippe Antoine about 2 months ago
- Assignee changed from OISF Dev to Jason Ish
Jason, is this about the lua crate ?
Updated by Jason Ish about 2 months ago ยท Edited
Philippe Antoine wrote in #note-2:
Jason, is this about the lua crate ?
Looks like a system header is being picked up instead of our locally provided Lua header, so probably more about the Makefile and CFLAGS and where system/macports headers exist on the Mac with MacPorts (which is probably different than Brew?). Just guessing tho.
Note that we do CI on Mac with Brew, but not MacPorts.
Updated by Jason Ish about 2 months ago
- Assignee changed from Jason Ish to OISF Dev
Updated by Jason Ish about 2 months ago
Note: Unassigned from me, at this time, I'm not equipped to work on it.
Updated by Marius Schamschula about 2 months ago
Jason Ish wrote in #note-3:
Philippe Antoine wrote in #note-2:
Jason, is this about the lua crate ?
Looks like a system header is being picked up instead of our locally provided Lua header, so probably more about the Makefile and CFLAGS and where system/macports headers exist on the Mac with MacPorts (which is probably different than Brew?). Just guessing tho.
Note that we do CI on Mac with Brew, but not MacPorts.
Sure enough, I have Lua installed (it is required by gnuplot for the luaterm). It provides the following headers:
/opt/local/include/lauxlib.h /opt/local/include/lua.h /opt/local/include/lua.hpp /opt/local/include/luaconf.h /opt/local/include/lualib.h
I temporarily deactivated the Lua package, and the Suricata 8.0.0 build went normally. This is something I can put up with, but once I push the port to MacPorts master others may not be as happy about the workaround.
Updated by Jason Ish about 2 months ago
What does the compile line look like when building util-lua-sandbox.c
(-I, etc). "make V=1" should display it.
Updated by Marius Schamschula about 2 months ago
Jason Ish wrote in #note-7:
What does the compile line look like when building
util-lua-sandbox.c
(-I, etc). "make V=1" should display it.
depbase=`echo util-lua-sandbox.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ /usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.sdk -I/opt/local/include -I/opt/local/include -D__SCFILENAME__=\"util-lua-sandbox\" -march=native -Wextra -Werror-implicit-function-declaration -Wno-error=unused-command-line-argument -fstack-protector -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wall -Wno-unused-parameter -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wwrite-strings -Wbad-function-cast -Wformat-security -Wno-format-nonliteral -Wmissing-format-attribute -funsigned-char -ggdb -O0 -pipe -Os -Os -arch arm64 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.sdk -arch arm64 -DOS_DARWIN -std=c11 -march=native -I./../rust/gen -I./../rust/dist -I../rust/gen -MT util-lua-sandbox.o -MD -MP -MF $depbase.Tpo -c -o util-lua-sandbox.o util-lua-sandbox.c &&\ mv -f $depbase.Tpo $depbase.Po util-lua-sandbox.c:223:24: error: use of undeclared identifier 'LUA_GNAME' 223 | if (strcmp(module, LUA_GNAME) == 0) { | ^ util-lua-sandbox.c:254:7: error: use of undeclared identifier 'LUA_GNAME' 254 | { LUA_GNAME, luaopen_base }, | ^ 2 errors generated.
As the build is multithreaded, I've edited out other files that got built while util-lua-sandbox.c was causing the error.
P.S.: I had previously meant to use --disable-silent-rules, as it is standard MacPorts protocol.
Updated by Juliana Fajardini Reichow about 2 months ago
- Subject changed from util-lua-sandbox.c undeclared identifier error for Suricate 8.0.0 to util-lua-sandbox.c undeclared identifier error for Suricata 8.0.0
Updated by Philippe Antoine about 1 month ago
Thanks Marius,
So, the problem looks like
/usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include ... -I../rust/gen ...
So, the system headers are preferred to the local ones
How did you run ./configure
? (do you have CFLAGS defined in your environment ? )
Updated by Philippe Antoine about 1 month ago
- Status changed from New to In Progress
- Assignee changed from OISF Dev to Philippe Antoine
@Marius Schamschula could you test https://github.com/OISF/suricata/pull/13625 ?
Updated by Philippe Antoine about 1 month ago
- Status changed from In Progress to In Review
Updated by Marius Schamschula about 1 month ago
Philippe Antoine wrote in #note-11:
@Marius Schamschula could you test https://github.com/OISF/suricata/pull/13625 ?
Philippe Antoine wrote in #note-10:
Thanks Marius,
So, the problem looks like
/usr/bin/clang -DHAVE_CONFIG_H -I. -I/opt/local/include ... -I../rust/gen ...
So, the system headers are preferred to the local ones
How did you run
./configure
? (do you have CFLAGS defined in your environment ? )
MacPorts automatically adds CFLAGS (and LDFLAGS, etc) corresponding to the install prefix (normally /opt/local)
Updated by Marius Schamschula about 1 month ago
Philippe Antoine wrote in #note-11:
@Marius Schamschula could you test https://github.com/OISF/suricata/pull/13625 ?
Unfortunately, that didn't help.
Updated by Philippe Antoine about 1 month ago
Did you run make clean; bash autogen.sh; ./configure
?
Updated by Marius Schamschula about 1 month ago
Philippe Antoine wrote in #note-15:
Did you run
make clean; bash autogen.sh; ./configure
?
I always start clean by extracting the source code.
In this case (after applying patches) it is followed by running autoreconf, followed by ./configure.
Updated by Philippe Antoine about 1 month ago
- Status changed from In Review to In Progress
- Assignee changed from Philippe Antoine to OISF Dev
Indeed...
So we understand the problem, but I do not know the autotool solution for this...
what are the first 40 lines of your /opt/local/include/lauxlib.h ?
Updated by Marius Schamschula about 1 month ago
Philippe Antoine wrote in #note-17:
Indeed...
So we understand the problem, but I do not know the autotool solution for this...
what are the first 40 lines of your /opt/local/include/lauxlib.h ?
/* ** $Id: lauxlib.h,v 1.131.1.1 2017/04/19 17:20:42 roberto Exp $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ #ifndef lauxlib_h #define lauxlib_h #include <stddef.h> #include <stdio.h> #include "lua.h" /* extra error code for 'luaL_loadfilex' */ #define LUA_ERRFILE (LUA_ERRERR+1) /* key, in the registry, for table of loaded modules */ #define LUA_LOADED_TABLE "_LOADED" /* key, in the registry, for table of preloaded loaders */ #define LUA_PRELOAD_TABLE "_PRELOAD" typedef struct luaL_Reg { const char *name; lua_CFunction func; } luaL_Reg; #define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number)) LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz); #define luaL_checkversion(L) \ luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
Updated by Philippe Antoine about 1 month ago
- Status changed from In Progress to In Review
- Assignee changed from OISF Dev to Philippe Antoine
@Marius Schamschula could you test https://github.com/OISF/suricata/pull/13635 ?
Updated by Marius Schamschula about 1 month ago
Philippe Antoine wrote in #note-19:
@Marius Schamschula could you test https://github.com/OISF/suricata/pull/13635 ?
I now get a clean build!
One other (unrelated) thing:
The rust build doesn't obey --disable-silent-rules
Updated by Philippe Antoine about 1 month ago
I now get a clean build!
Cool
One other (unrelated) thing:
The rust build doesn't obey
--disable-silent-rules
I am not sure what that means, so you can create another ticket if you want...
Updated by Jason Ish 24 days ago
- Status changed from In Review to Closed
Merged via https://github.com/OISF/suricata/pull/13683.