Project

General

Profile

Actions

Bug #7804

closed

util-lua-sandbox.c undeclared identifier error for Suricata 8.0.0

Added by Marius Schamschula 30 days ago. Updated 3 days ago.

Status:
Closed
Priority:
Normal
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

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.

Actions #1

Updated by Victor Julien 30 days ago

  • Target version changed from 8.0.0 to 8.0.1
  • Affected Versions 8.0.0 added
Actions #2

Updated by Philippe Antoine 29 days ago

  • Assignee changed from OISF Dev to Jason Ish

Jason, is this about the lua crate ?

Actions #3

Updated by Jason Ish 29 days 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.

Actions #4

Updated by Jason Ish 29 days ago

  • Assignee changed from Jason Ish to OISF Dev
Actions #5

Updated by Jason Ish 29 days ago

Note: Unassigned from me, at this time, I'm not equipped to work on it.

Actions #6

Updated by Marius Schamschula 29 days 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.

Actions #7

Updated by Jason Ish 29 days ago

What does the compile line look like when building util-lua-sandbox.c (-I, etc). "make V=1" should display it.

Actions #8

Updated by Marius Schamschula 29 days 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.

Actions #9

Updated by Juliana Fajardini Reichow 28 days 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
Actions #10

Updated by Philippe Antoine 16 days 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 ? )

Actions #11

Updated by Philippe Antoine 16 days ago

  • Status changed from New to In Progress
  • Assignee changed from OISF Dev to Philippe Antoine
Actions #12

Updated by Philippe Antoine 16 days ago

  • Status changed from In Progress to In Review
Actions #13

Updated by Marius Schamschula 16 days 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)

Actions #14

Updated by Marius Schamschula 16 days ago

Philippe Antoine wrote in #note-11:

@Marius Schamschula could you test https://github.com/OISF/suricata/pull/13625 ?

Unfortunately, that didn't help.

Actions #15

Updated by Philippe Antoine 16 days ago

Did you run make clean; bash autogen.sh; ./configure ?

Actions #16

Updated by Marius Schamschula 16 days 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.

Actions #17

Updated by Philippe Antoine 16 days 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 ?

Actions #18

Updated by Marius Schamschula 16 days 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)
Actions #19

Updated by Philippe Antoine 15 days ago

  • Status changed from In Progress to In Review
  • Assignee changed from OISF Dev to Philippe Antoine
Actions #20

Updated by Marius Schamschula 15 days 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

Actions #21

Updated by Philippe Antoine 15 days 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...

Actions #22

Updated by Jason Ish 3 days ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF