xmake icon indicating copy to clipboard operation
xmake copied to clipboard

error: implicit declaration of function ‘lua_objlen’; did you mean ‘lua_len’?

Open Ashvith10 opened this issue 6 months ago • 3 comments

Xmake Version

3.0.1

Operating System Version and Architecture

Linux wisteria 6.12.41 #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux

Describe Bug

When trying to build xmake with system dependencies on GNU Guix, the build fails, complaining about the implicit declaration of function "lua_objlen".

Expected Behavior

I should be able to build xmake successfully.

Project Configuration

I have not modified anything about xmake.

Additional Information and Error Logs

compiling.release core/src/xmake/bloom_filter/bloom_filter_clear.c
core/src/xmake/engine.c: In function ‘xm_engine_save_arguments’:
core/src/xmake/engine.c:650:47: error: implicit declaration of function ‘lua_objlen’; did you mean ‘lua_len’? [-Wimplicit-function-declaration]
  650 |             lua_rawseti(engine->lua, -2, (int)lua_objlen(engine->lua, -2) + 1);
      |                                               ^~~~~~~~~~
      |                                               lua_len

Ashvith10 avatar Aug 26 '25 08:08 Ashvith10

what's your lua version?

waruqi avatar Aug 26 '25 15:08 waruqi

@waruqi I am using Lua v5.4.8.

Ashvith10 avatar Aug 26 '25 17:08 Ashvith10

It should exists if LUA_COMPAT_5_3 is defined.

https://github.com/xmake-io/xmake/blob/3dd5c00c62dcd51ded121a9a0bdb524739fd0bec/core/xmake.sh#L86

#if defined(LUA_COMPAT_5_3)	/* { */

#define lua_objlen(L,i)		lua_rawlen(L, (i)) <--------------------------------------

#endif				/* } */

you can run make VERBOSE=1 to check verbose flags.

clang -c -Qunused-arguments -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk" -target x86_64-apple-macos15.2  -fvisibility=hidden  -Oz  -Wa
ll  -std=c99  -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DXM_CONFIG_API_HAVE_READLINE -DXM_CONFIG_API_HAVE_CURSES -D__tb_prefix__=\"
xmake\"  -Icore/src/xmake/.. -Ibuild/macosx/x86_64/release -Icore/src/xmake/../xxhash -Ixmake/scripts/module -I/usr/local/opt/lz4/include -I/usr/local/include/lua -Wno-error=deprecated-declarations -f
no-strict-aliasing -Wno-error=nullability-completeness -Wno-error=parentheses-equality -o build/.objs/xmake/macosx/x86_64/release/core/src/xmake/engine.c.o core/src/xmake/engine.c
I

-DLUA_COMPAT_5_3

waruqi avatar Aug 27 '25 02:08 waruqi