Build error on openSUSE 15.3

  • zinser
    7th Aug 2021 Member 0 Permalink

    Trying to build the latest release tag 96.1.349.

     

    Meson seems to run ok and requirements should be fulfilled:

    mzinser@discovery:~/Downloads/The-Powder-Toy-96.1.349> meson build-debug
    The Meson build system
    Version: 0.56.0
    Source dir: /home/mzinser/Downloads/The-Powder-Toy-96.1.349
    Build dir: /home/mzinser/Downloads/The-Powder-Toy-96.1.349/build-debug
    Build type: native build
    Project name: the-powder-toy
    Project version: the.cake.is.a.lie
    C compiler for the host machine: cc (gcc 7.5.0 "cc (SUSE Linux) 7.5.0")
    C linker for the host machine: cc ld.bfd 2.35.1.20201123-7
    C++ compiler for the host machine: c++ (gcc 7.5.0 "c++ (SUSE Linux) 7.5.0")
    C++ linker for the host machine: c++ ld.bfd 2.35.1.20201123-7
    Host machine cpu family: x86_64
    Host machine cpu: x86_64
    Program python3 found: YES (/usr/bin/python3)
    Found pkg-config: /usr/bin/pkg-config (0.29.2)
    Run-time dependency luajit found: YES 2.2.0
    Run-time dependency libcurl found: YES 7.66.0
    Run-time dependency fftw3f found: YES 3.3.9
    Run-time dependency threads found: YES
    Run-time dependency zlib found: YES 1.2.11
    Run-time dependency sdl2 found: YES 2.0.14
    Configuring Config.h using configuration
    Configuring ElementNumbers.h using configuration
    Configuring ToolNumbers.h using configuration
    Build targets in project: 1

    Found ninja-1.10.2 at /usr/bin/ninja

    But actual build fails:

    mzinser@discovery:~/Downloads/The-Powder-Toy-96.1.349> cd build-debug/
    mzinser@discovery:~/Downloads/The-Powder-Toy-96.1.349/build-debug> ninja
    [3/356] Compiling C object powder.p/src_lua_LuaCompat.c.o
    FAILED: powder.p/src_lua_LuaCompat.c.o
    cc -Ipowder.p -I. -I.. -Isrc -I../src -Idata -I../data -Iresources -I../resources -Isrc/config/powder -I../src/config/powder -I/usr/include/SDL2 -I/usr/include/moonjit-2.2 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g -D_REENTRANT -pthread -U__STRICT_ANSI__ -Wno-unused-result -msse2 -msse -MD -MQ powder.p/src_lua_LuaCompat.c.o -MF powder.p/src_lua_LuaCompat.c.o.d -o powder.p/src_lua_LuaCompat.c.o -c ../src/lua/LuaCompat.c
    In file included from ../src/lua/LuaCompat.h:10:0,
                     from ../src/lua/LuaCompat.c:1:
    /usr/include/moonjit-2.2/lua.h:38:26: error: expected declaration specifiers or ‘...’ before ‘(’ token
     #define LUA_GLOBALSINDEX (-10002)
                              ^
    /usr/include/moonjit-2.2/lua.h:288:49: note: in expansion of macro ‘LUA_GLOBALSINDEX’
     #define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
                                                     ^~~~~~~~~~~~~~~~
    ../src/lua/LuaCompat.c:23:6: note: in expansion of macro ‘lua_pushglobaltable’
     void lua_pushglobaltable(lua_State *L)
          ^~~~~~~~~~~~~~~~~~~
    [8/356] Precompiling header ../pch/pch_cpp.h
    ninja: build stopped: subcommand failed.

    Note: moonjit is the package providing luajit on openSUSE.

    Any hints what to check/how to fix this?

  • LBPHacker
    7th Aug 2021 Developer 1 Permalink
    At a first glance, it seems moonjit lies about which Lua version it is. Our (compatibility) definitions of lua_pushglobaltable are protected by LUA_VERSION_NUM >= 502 (they're in the false branch), but it seems that moonjit defines LUA_VERSION_NUM to be below 502 but also defines lua_pushglobaltable. lua_pushglobaltable should not exist below Lua 5.2, so I believe this to be a problem with moonjit, not TPT. I suggest you contact your package maintainers or moonjit developers.

    Until they fix the problem, just throw an #ifndef lua_pushglobaltable around our declaration and definition of lua_pushglobaltable; moonjit seems to implement it as a macro.

    I'll be looking into this, take what I said with a pinch of salt.
    Edited once by LBPHacker. Last: 7th Aug 2021
  • zinser
    8th Aug 2021 Member 0 Permalink

    That did do the trick, powder is building correctly now. I'll check if I can see something in the moonjit up-stream or file a report with the openSUSE project.

     

    P.S. I did look into the up-stream. Both luajit (since 2017) and moonjit (since 2020) seem to be abandoned, which gives pretty slim chances to get a fix in there.

    Could the #ifndef added to powder, so others don't fall into the same trap as me?

    Thanks a lot!

    P.P.S. I did a build of the head/master branch (2.3.0-dev) of moonjit, which is ahead of the version 2.2.0 distributed by openSUSE. Behaviour unfortunately is the same as reported.

    Edited 2 times by zinser. Last: 8th Aug 2021
  • LBPHacker
    9th Aug 2021 Developer 1 Permalink
    Done.