cloudwu / cloudwu/sproto

xlua macos luajit 编译报错

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
982
Forks
254
PR merge metrics
No merged PRs in 30d

Description

一开始其他平台编译luajit报错lua_tointegerx 的static定义有问题,注释掉这段之后继续
#if LUA_VERSION_NUM < 502
/* static int64_t lua_tointegerx(lua_State *L, int idx, int *isnum) {
if (lua_isnumber(L, idx)) {
if (isnum) *isnum = 1;
return (int64_t)lua_tointeger(L, idx);
}
else {
if (isnum) *isnum = 0;
return 0;
}
} */

到后面又有报错,提示lua_tointegerx定义不清晰,看了下,macos下编译luajit,用的是lua5.1的代码,就会有问题
/Users/runner/work/xLua/xLua/build/sproto/lsproto.c:295:8: error: implicit declaration of function 'lua_tointegerx' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

想问下这里应该如何兼容各种情况呢?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with build/sproto/lsproto.c and inspect how lua_tointegerx is declared or used under Lua 5.1 and LuaJIT. Reproduce the macOS compilation error and compare it with the other platform builds; done means the relevant configurations compile without the implicit-declaration or conflicting-definition errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.