Jump to content

How to convert to LUA 5.4


Recommended Posts

I tried upgrading to LUA 5.4 by fixing the liblua source in the server. I changed the config file a little bit like this:

INC= /usr/local/include/lua54 #$(LUA)/include

and I've been googling enough issues and errors from the terminals but there are things I'm not that familiar with. Here is an example:

Spoiler
gmake[1]: Entering directory '/usr/metin2/src/liblua/include'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory '/usr/metin2/src/liblua/include'
cd src; gmake all
gmake[1]: Entering directory '/usr/metin2/src/liblua/src'
clang-devel -O2 -g -Wall -I/usr/local/include/lua54       -c -o lapi.o lapi.c
clang-devel -O2 -g -Wall -I/usr/local/include/lua54       -c -o ldebug.o ldebug.c
clang-devel -O2 -g -Wall -I/usr/local/include/lua54       -c -o ldo.o ldo.c
clang-devel -O2 -g -Wall -I/usr/local/include/lua54       -c -o lvm.o lvm.c
clang-devel -O2 -g -Wall -I/usr/local/include/lua54       -c -o lzio.o lzio.c
lzio.c:40:25: error: unknown type name 'lua_Chunkreader'
void luaZ_init (ZIO *z, lua_Chunkreader reader, void *data, const char *name) {
                        ^
1 error generated.
gmake[1]: *** [<builtin>: lzio.o] Error 1
gmake[1]: *** Waiting for unfinished jobs....
ldebug.c:65:13: error: conflicting types for 'lua_sethook'
LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {
            ^
/usr/local/include/lua54/lua.h:462:15: note: previous declaration is here
lapi.c:178:40: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
              ^
LUA_API void lua_remove (lua_State *L, int idx) {
                                       ^
lapi.c:178:14: error: expected parameter declarator
LUA_API void lua_remove (lua_State *L, int idx) {
             ^
/usr/local/include/lua54/lua.h:391:49: note: expanded from macro 'lua_remove'
#define lua_remove(L,idx)       (lua_rotate(L, (idx), -1), lua_pop(L, 1))
                                                      ^
lapi.c:178:14: error: expected ')'
/usr/local/include/lua54/lua.h:391:49: note: expanded from macro 'lua_remove'
#define lua_remove(L,idx)       (lua_rotate(L, (idx), -1), lua_pop(L, 1))
                                                      ^
lapi.c:178:14: note: to match this '('
/usr/local/include/lua54/lua.h:391:38: note: expanded from macro 'lua_remove'
#define lua_remove(L,idx)       (lua_rotate(L, (idx), -1), lua_pop(L, 1))
                                           ^
lapi.c:178:14: error: expected ')'
LUA_API void lua_remove (lua_State *L, int idx) {
             ^
/usr/local/include/lua54/lua.h:391:52: note: expanded from macro 'lua_remove'
#define lua_remove(L,idx)       (lua_rotate(L, (idx), -1), lua_pop(L, 1))
                                                         ^
lapi.c:178:14: note: to match this '('
/usr/local/include/lua54/lua.h:391:27: note: expanded from macro 'lua_remove'
#define lua_remove(L,idx)       (lua_rotate(L, (idx), -1), lua_pop(L, 1))
                                ^
lapi.c:178:14: error: conflicting types for 'lua_rotate'
lvm.c:60:34: LUA_API void lua_remove (lua_State *L, int idx) {
             ^error:
too few arguments provided to function-like macro invocation/usr/local/include/lua54/lua.h:
391:28: note: expanded from macro 'lua_remove'
    lua_number2str(s, nvalue(obj));
                                 ^
#define lua_remove(L,idx)       (lua_rotate(L, (idx), -1), lua_pop(L, 1))
                                 ^
/usr/local/include/lua54/lua.h:171/usr/local/include/lua54/luaconf.h::16401::9: note:  note: macro 'lua_number2str' defined hereprevious declaration is here

#define lua_number2str(s,sz,n)  \
        ^
LUA_API void  (lua_rotate) (lua_State *L, int idx, int n);
               ^
lapi.c:178:40: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
LUA_API void lua_remove (lua_State *L, int idx) {
                                       ^
ldebug.clapi.c::110181::1421::  error: incompatible integer to pointer conversion assigning to 'struct CallInfo *' from 'int' [-Wint-conversion]
error: use of undeclared identifier 'idx'
    ar->i_ci = ci - (CallInfo *)L->base_ci;
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~  p = luaA_index(L, idx);
                    ^

lapi.c:188:40: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
LUA_API void lua_insert (lua_State *L, int idx) {
                                       ^
lapi.c:188:14: error: expected parameter declarator
LUA_API void lua_insert (lua_State *L, int idx) {
             ^
/usr/local/include/lua54/lua.h:389:48: note: expanded from macro 'lua_insert'
#define lua_insert(L,idx)       lua_rotate(L, (idx), 1)
                                                     ^
lapi.c:188:14: error: expected ')'
/usr/local/include/lua54/lua.h:389:48: note: expanded from macro 'lua_insert'
#define lua_insert(L,idx)       lua_rotate(L, (idx), 1)
                                                     ^
lapi.c:188:14: note: to match this '('
/usr/local/include/lua54/lua.h:389:37: note: expanded from macro 'lua_insert'
#define lua_insert(L,idx)       lua_rotate(L, (idx), 1)
                                          ^
lapi.c:188:14: error: lvm.c:60:5:ldo.c :168:15conflicting types for 'lua_rotate': error:
use of undeclared identifier 'lua_number2str'
LUA_API void lua_insert (lua_State *L, int idx) {
    lua_number2str(s, nvalue(obj));
             ^    ^

/usr/local/include/lua54/lua.h:389:27: note: ldebug.c:128:31: error: invalid operands to binary expression ('CallInfo *' (aka 'struct CallInfo *') and 'struct CallInfo *const')
expanded from macro 'lua_insert'
  ci = (CallInfo *)L->base_ci + ar->i_ci;
       ~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
#define lua_insert(L,idx)       lua_rotate(L, (idx), 1)
                                ^
/usr/local/include/lua54/lua.h:171:16: note: previous declaration is here
error: LUA_API void  (lua_rotate) (lua_State *L, int idx, int n);incompatible integer to pointer conversion assigning to 'struct CallInfo *' from 'int' [-Wint-conversion]

               ^
lapi.c:188:40: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
LUA_API void lua_insert (lua_State *L, int idx) {
                                       ^      ar.i_ci = L->ci - L->base_ci;
              ^ ~~~~~~~~~~~~~~~~~~

ldebug.c:146:31: error: invalid operands to binary expression ('CallInfo *' (aka 'struct CallInfo *') and 'struct CallInfo *const')
  ci = (CallInfo *)L->base_ci + ar->i_ci;
       ~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
lapi.c:192:21: error: use of undeclared identifier 'idx'
  p = luaA_index(L, idx);
                    ^
lapi.c:199:14: error: expected parameter declarator
LUA_API void lua_replace (lua_State *L, int idx) {
             ^
/usr/local/include/lua54/lua.h:393:41: note: expanded from macro 'lua_replace'
#define lua_replace(L,idx)      (lua_copy(L, -1, (idx)), lua_pop(L, 1))
                                             ^
lapi.c:199:14: error: expected ')'
/usr/local/include/lua54/lua.h:393:41: note: expanded from macro 'lua_replace'
#define lua_replace(L,idx)      (lua_copy(L, -1, (idx)), lua_pop(L, 1))
                                             ^
lapi.c:199:14: note: to match this '('
/usr/local/include/lua54/lua.h:393:37: note: expanded from macro 'lua_replace'
#define lua_replace(L,idx)      (lua_copy(L, -1, (idx)), lua_pop(L, 1))
                                         ^
lapi.c:199:14: error: expected ')'
ldebug.c:249:43: error: invalid operands to binary expression ('CallInfo *' (aka 'struct CallInfo *') and 'struct CallInfo *')
    CallInfo *ci = (CallInfo *)L->base_ci + ar->i_ci;
                   ~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
LUA_API void lua_replace (lua_State *L, int idx) {
             ^
/usr/local/include/lua54/lua.h:393:51: note: expanded from macro 'lua_replace'
#define lua_replace(L,idx)      (lua_copy(L, -1, (idx)), lua_pop(L, 1))
                                                       ^
lapi.c:199:14: note: to match this '('
/usr/local/include/lua54/lua.h:393:28: note: expanded from macro 'lua_replace'
#define lua_replace(L,idx)      (lua_copy(L, -1, (idx)), lua_pop(L, 1))
                                ^
lapi.c:199:14: error: conflicting types for 'lua_copy'
LUA_API void lua_replace (lua_State *L, int idx) {
             ^
/usr/local/include/lua54/lua.h:393:29: note: expanded from macro 'lua_replace'
#define lua_replace(L,idx)      (lua_copy(L, -1, (idx)), lua_pop(L, 1))
                                 ^
/usr/local/include/lua54/lua.h:172:16: note: previous declaration is here
LUA_API void  (lua_copy) (lua_State *L, int fromidx, int toidx);
               ^
lapi.c:202:24: error: use of undeclared identifier 'idx'
  setobj(luaA_index(L, idx), L->top - 1);  /* write barrier */
                       ^
lapi.c:294:48: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
LUA_API lua_Number lua_tonumber (lua_State *L, int idx) {
                                               ^
lapi.c:294:20: error: expected ')'
LUA_API lua_Number lua_tonumber (lua_State *L, int idx) {
                   ^
/usr/local/include/lua54/lua.h:361:47: note: expanded from macro 'lua_tonumber'
#define lua_tonumber(L,i)       lua_tonumberx(L,(i),NULL)
                                                    ^
/usr/include/sys/_null.h:34:23: note: expanded from macro 'NULL'
#define NULL    ((void *)0)
                         ^
lapi.c:294:20: note: to match this '('
/usr/local/include/lua54/lua.h:361:47: note: expanded from macro 'lua_tonumber'
#define lua_tonumber(L,i)       lua_tonumberx(L,(i),NULL)
                                                    ^
/usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
#define NULL    ((void *)0)
                ^
lapi.c:294:20: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
LUA_API lua_Number lua_tonumber (lua_State *L, int idx) {
                   ^
/usr/local/include/lua54/lua.h:361:47: note: expanded from macro 'lua_tonumber'
#define lua_tonumber(L,i)       lua_tonumberx(L,(i),NULL)
                                                    ^
/usr/include/sys/_null.h:34:16: note: expanded from macro 'NULL'
#define NULL    ((void *)0)
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
ldo.c:359:13: error: conflicting types for 'lua_resume'
LUA_API int lua_resume (lua_State *L, int nargs) {
            ^
/usr/local/include/lua54/lua.h:300:15: note: previous declaration is here
LUA_API int  (lua_resume)     (lua_State *L, lua_State *from, int narg,
              ^
5 errors generated.
ldo.c:386:38: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
LUA_API int lua_yield (lua_State *L, int nresults) {
                                     ^
ldo.c:386:13: error: expected parameter declarator
LUA_API int lua_yield (lua_State *L, int nresults) {
            ^
/usr/local/include/lua54/lua.h:305:44: note: expanded from macro 'lua_yield'
#define lua_yield(L,n)          lua_yieldk(L, (n), 0, NULL)
                                                   ^
ldo.c:386:13: error: expected ')'
/usr/local/include/lua54/lua.h:305:44: note: expanded from macro 'lua_yield'
#define lua_yield(L,n)          lua_yieldk(L, (n), 0, NULL)
                                                   ^
ldo.c:386:13: note: to match this '('
/usr/local/include/lua54/lua.h:305:35: note: expanded from macro 'lua_yield'
#define lua_yield(L,n)          lua_yieldk(L, (n), 0, NULL)
                                          ^
ldo.c:386:13: error: conflicting types for 'lua_yieldk'
LUA_API int lua_yield (lua_State *L, int nresults) {
            ^
/usr/local/include/lua54/lua.h:305:25: note: expanded from macro 'lua_yield'
#define lua_yield(L,n)          lua_yieldk(L, (n), 0, NULL)
                                ^
/usr/local/include/lua54/lua.h:298:15: note: previous declaration is here
LUA_API int  (lua_yieldk)     (lua_State *L, int nresults, lua_KContext ctx,
              ^
ldo.c:386:38: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions]
LUA_API int lua_yield (lua_State *L, int nresults) {
                                     ^
ldo.c:395:18: error: use of undeclared identifier 'nresults'
    if (L->top - nresults > L->base) {  /* is there garbage in the stack? */
                 ^
ldo.c:397:19: error: use of undeclared identifier 'nresults'
      for (i=0; i<nresults; i++)  /* move down results */
                  ^
ldo.c:398:41: error: use of undeclared identifier 'nresults'
        setobjs2s(L->base + i, L->top - nresults + i);
                                        ^
./lobject.h:154:19: note: expanded from macro 'setobjs2s'
#define setobjs2s       setobj
                        ^
ldo.c:399:26: error: use of undeclared identifier 'nresults'
      L->top = L->base + nresults;
                         ^
2 warnings and 20 errors generated.
gmake[1]: *** [<builtin>: ldebug.o] Error 1
gmake[1]: *** [<builtin>: lapi.o] Error 1
1 warning and 10 errors generated.
gmake[1]: *** [<builtin>: ldo.o] Error 1
2 errors generated.
gmake[1]: *** [<builtin>: lvm.o] Error 1

 

Anyone tried this before or fixed similar issues?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Contributor

Your first error is:

lzio.c:40:25: error: unknown type name 'lua_Chunkreader'

Do you have this in lua.h?

typedef const char* (*lua_Chunkreader) (lua_State* L, void* ud, size_t* sz);

 

Also: The fuck do you mean by "fixing the liblua source in the server"? What's wrong with it?

Link to comment
Share on other sites

13 hours ago, Amun said:

Your first error is:

lzio.c:40:25: error: unknown type name 'lua_Chunkreader'

Do you have this in lua.h?

typedef const char* (*lua_Chunkreader) (lua_State* L, void* ud, size_t* sz);

 

Also: The fuck do you mean by "fixing the liblua source in the server"? What's wrong with it?

I solved this one this is just replacing 'Chunkreader' with 'Reader' and 'Chunkwriter' with 'Writer'

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.