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

源里面的lua有配置导致stdlib.h编译不过 #3348

Open
myzhan opened this issue Feb 26, 2024 · 6 comments
Open

源里面的lua有配置导致stdlib.h编译不过 #3348

myzhan opened this issue Feb 26, 2024 · 6 comments
Labels

Comments

@myzhan
Copy link

myzhan commented Feb 26, 2024

Xmake Version

xmake v2.8.5+20231107

Operating System Version and Architecture

macOS sonama

Describe Bug

远程仓库里面的 lua,luaconf.h 文件带了一个宏。

#if defined(LUA_LIB)
/* disable system calls as it's not available on this sytem */
#define system(s) ((s)==NULL ? 0 : -1)
#endif

如果代码里面引入了 stdlib.h,用 android 和 ios 的工具链编译会失败,macOS 下面正常。

Expected Behavior

正常编译通过。最好是不要修改 lua 的源码。

Project Configuration

跟我的项目配置关系不大。

编译命令:

xmake f -p android -a arm64-v8a -k static -y --lua_version=5.4

Additional Information and Error Logs

编译报错的日志。

In file included from /Users/zhanqp/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/local/include/stdlib.h:31:
/Users/zhanqp/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/stdlib.h:122:12: error: expected identifier or '('
int system(const char* __command);
           ^
/Users/zhanqp/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/stdlib.h:122:12: error: expected ')'
/Users/zhanqp/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/stdlib.h:122:5: note: to match this '('
int system(const char* __command);
    ^
/Users/zhanqp/.xmake/packages/l/lua/v5.4.6/442103e0a96a45439f75151e223122e7/include/lua/luaconf.h:799:20: note: expanded from macro 'system'
#define system(s) ((s)==NULL ? 0 : -1)
@myzhan myzhan added the bug label Feb 26, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: The lua in the source is configured so that stdlib.h cannot be compiled.

@waruqi
Copy link
Member

waruqi commented Feb 27, 2024

这种包问题,你自己直接提个 pr 过来到 xmake-repo 改进下包就行了。

@waruqi waruqi transferred this issue from xmake-io/xmake Feb 27, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: The lua in the source is configured so that stdlib.h cannot be compiled.

@myzhan
Copy link
Author

myzhan commented Feb 27, 2024

当前这个宏,应该只在 .c 源码里面生效,在 .h 头文件里面不行。因为目前 ndk 里面是有 system 函数的,不清楚能否提 pr 删掉?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Currently, this macro should only take effect in the .c source code, not the .h header file. Because there is currently a system function in ndk, I don’t know if I can delete it through PR?

@waruqi
Copy link
Member

waruqi commented Feb 27, 2024

既然 ndk 有 system ,跟它的 system 冲突了,你 patch 下 luaconf.h 把里面的 system 去了不就好了么。。#if defined(LUA_LIB) -> #if 0

一行代码的事情,仅对 android 修改,又不影响什么。

#if defined(LUA_LIB)
/* disable system calls as it's not available on this sytem */
#define system(s) ((s)==NULL ? 0 : -1)
#endif

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

No branches or pull requests

3 participants