Error while trying to compile with scons

  • player4444
    24th Feb 2019 Member 0 Permalink

    I'm trying to compile a test for RES with scons on Windows 7 64 bit. I followed all the steps for compiling. In the terminal, I put in:

     


    cd

    cd The-Powder-Toy/

    scons.py -j8  // I have 8 cores, thats why I use -j8

     

    I get the following:

     

    scons: Reading SConscript files ...
    Checking whether the C compiler works... yes
    Checking whether the C++ compiler works... yes
    Checking if 64 bit... no
    Adding 32 bit compile flags
    Checking for C library mingw32... yes
    Checking for C library ws2_32... yes
    Checking for C library SDL2main... no
    libSDL2main not found or not installed

     

    I can't find anything but the script for scons. Help please.

  • jacob1
    24th Feb 2019 Developer 1 Permalink
    The guide only has SDL1.2, not SDL2. It does link to SDL2 though: https://www.libsdl.org/download-2.0.php

    You specifically will want this download: https://www.libsdl.org/release/SDL2-devel-2.0.9-mingw.tar.gz

    from there, copy i686-w64-mingw32/include and i686-w64-mingw32/lib to C:\MinGW or wherever you installed it.
  • player4444
    25th Feb 2019 Member 0 Permalink

    Thanks for the help, but I'm now getting the error:

     

    \generated -Igenerated src\lua\LuaBit.cpp
    g++ -o build\src\lua\LuaButton.o -c -std=c++11 -U__STRICT_ANSI__ -Wno-invalid-offsetof -msse -msse2 -DSDL_INC -DLUA_R_INCL -DWIN -D_WIN32_WINNT=0x0501 -D_USING_V110_SDK71_ -DX86 -DX86_SSE -DX86_SSE2 -DGRAVFFT -DLUACONSOLE -Ibuild\src -Isrc -Ibuild\data -Idata -Ibuild\generated -Igenerated src\lua\LuaButton.cpp
    =====
    src\lua\LuaBit.cpp: In function 'int luaopen_bit(lua_State*)':
    src\lua\LuaBit.cpp:182:36: error: 'luaL_register' was not declared in this scope
    luaL_register(L, "bit", bit_funcs);
    ^

    =====
    scons: *** [build\src\lua\LuaBit.o] Error 1
    =====
    In file included from src\lua\LuaButton.h:3:0,
    from src\lua\LuaButton.cpp:4:
    src\lua\LuaLuna.h: In static member function 'static bool Luna<T>::checkType(lua_State*, int, const char*)':
    src\lua\LuaLuna.h:100:28: error: there are no arguments to 'lua_equal' that depend on a template parameter, so a declaration of 'lua_equal' must be available [-fpermissive]
    res = lua_equal(L, -2, -1);
    ^
    src\lua\LuaLuna.h:100:28: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)

    =====
    scons: *** [build\src\lua\LuaButton.o] Error 1
    scons: building terminated because of errors.
    strip: 'build/Powder.exe': No such file

  • jacob1
    25th Feb 2019 Developer 0 Permalink
    @player4444 (View Post)
    Did you use the Lua from the guide, or compile your own lua?

    Officially, TPT uses luajit. The guide gives a lua 5.1 download though. Both of these are supported by the code with no other changes. I think Lua 5.2 is also supported without changes in the source code. 5.3 is not supported, functions like luaL_register were removed in Lua 5.3, which is probably why the build fails for you.
  • player4444
    25th Feb 2019 Member 0 Permalink

    Im using the 5.1 given by the guide. 

    Edit: I copied the lib and include folders given by the guide and restarted the terminal, no luck.

    Edited once by player4444. Last: 25th Feb 2019
  • jacob1
    25th Feb 2019 Developer 0 Permalink
    @player4444 (View Post)
    I'm almost certain you have lua 5.3 installed. I don't know where it came from, but the errors imply you do. I just looked it up and lua_equal was also removed in lua 5.3 (deprecated in 5.2). So that's why that would error.

    If you had MinGW installed for something else before, maybe you used lua 5.3. All I can really say is that you should make sure to remove lua 5.3, or use env variables to point it to lua 5.1 instead.

    I should probably add support for lua 5.3, but that isn't going to happen soon because we use luajit in the release builds, so can't upgrade to 5.3 (luajit is a mix between 5.1 and 5.2)

    Edit: I would check C:\MinGW\include and C:\MinGW\lib for lua 5.3. You'll probably find traces of it in there if it exists.
    Edited once by jacob1. Last: 25th Feb 2019
  • player4444
    25th Feb 2019 Member 0 Permalink

    Well the compiler has gotten much further now. Ill update soon. Thanks!

  • jacob1
    25th Feb 2019 Developer 0 Permalink
    It's better to make a new post in the thread, not an edit. I get notified immediately when someone posts, not when they edit.

    (This is why I'm posting now :P)
  • player4444
    25th Feb 2019 Member 0 Permalink

    Oh noes! I got a big error!

     

    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x5280): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x5296): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x52ac): undefined reference to `lua_tonumber'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x819f): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x8264): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x827a): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x8290): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x82a6): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x82bc): more undefined references to `lua_tointeger' follow
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x8deb): undefined reference to `luaL_register'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x9848): undefined reference to `lua_objlen'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x9891): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x9a5c): undefined reference to `lua_objlen'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x9aa5): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x9c64): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0x9ea5): undefined reference to `luaL_register'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xadba): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xb84c): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xbe07): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xc0b6): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xc58f): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xc73b): undefined reference to `luaL_register'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xc8f0): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xc906): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xcaed): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xcb03): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xcb19): undefined reference to `lua_tointeger'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xcb2f): more undefined references to `lua_tointeger' follow
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xd4b5): undefined reference to `luaL_register'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xdb57): undefined reference to `luaL_register'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xde4d): undefined reference to `luaL_register'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xe601): undefined reference to `luaL_loadbuffer'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xe6a6): undefined reference to `luaL_loadbuffer'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text+0xe867): undefined reference to `lua_pcall'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI9LuaButtonE6tryGetEP9lua_Statei[__ZN4LunaI9LuaButtonE6tryGetEP9lua_Statei]+0x5d): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI8LuaLabelE6tryGetEP9lua_Statei[__ZN4LunaI8LuaLabelE6tryGetEP9lua_Statei]+0x5d): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI10LuaTextboxE6tryGetEP9lua_Statei[__ZN4LunaI10LuaTextboxE6tryGetEP9lua_Statei]+0x5d): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI11LuaCheckboxE6tryGetEP9lua_Statei[__ZN4LunaI11LuaCheckboxE6tryGetEP9lua_Statei]+0x5d): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI9LuaSliderE6tryGetEP9lua_Statei[__ZN4LunaI9LuaSliderE6tryGetEP9lua_Statei]+0x5d): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI14LuaProgressBarE6tryGetEP9lua_Statei[__ZN4LunaI14LuaProgressBarE6tryGetEP9lua_Statei]+0x5d): more undefined references to `luaL_typerror' follow
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI9LuaButtonE9checkTypeEP9lua_StateiPKc[__ZN4LunaI9LuaButtonE9checkTypeEP9lua_StateiPKc]+0x64): undefined reference to `lua_equal'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI8LuaLabelE9checkTypeEP9lua_StateiPKc[__ZN4LunaI8LuaLabelE9checkTypeEP9lua_StateiPKc]+0x64): undefined reference to `lua_equal'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI10LuaTextboxE9checkTypeEP9lua_StateiPKc[__ZN4LunaI10LuaTextboxE9checkTypeEP9lua_StateiPKc]+0x64): undefined reference to `lua_equal'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI11LuaCheckboxE9checkTypeEP9lua_StateiPKc[__ZN4LunaI11LuaCheckboxE9checkTypeEP9lua_StateiPKc]+0x64): undefined reference to `lua_equal'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI9LuaSliderE9checkTypeEP9lua_StateiPKc[__ZN4LunaI9LuaSliderE9checkTypeEP9lua_StateiPKc]+0x64): undefined reference to `lua_equal'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI14LuaProgressBarE9checkTypeEP9lua_StateiPKc[__ZN4LunaI14LuaProgressBarE9checkTypeEP9lua_StateiPKc]+0x64): more undefined references to `lua_equal' follow
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI9LuaButtonE5checkEP9lua_Statei[__ZN4LunaI9LuaButtonE5checkEP9lua_Statei]+0x3f): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI8LuaLabelE5checkEP9lua_Statei[__ZN4LunaI8LuaLabelE5checkEP9lua_Statei]+0x3f): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI10LuaTextboxE5checkEP9lua_Statei[__ZN4LunaI10LuaTextboxE5checkEP9lua_Statei]+0x3f): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI11LuaCheckboxE5checkEP9lua_Statei[__ZN4LunaI11LuaCheckboxE5checkEP9lua_Statei]+0x3f): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI9LuaSliderE5checkEP9lua_Statei[__ZN4LunaI9LuaSliderE5checkEP9lua_Statei]+0x3f): undefined reference to `luaL_typerror'
    build\src\lua\LuaScriptInterface.o:LuaScriptInterface.cpp:(.text$_ZN4LunaI14LuaProgressBarE5checkEP9lua_Statei[__ZN4LunaI14LuaProgressBarE5checkEP9lua_Statei]+0x3f): more undefined references to `luaL_typerror' follow
    build\src\lua\LuaSlider.o:LuaSlider.cpp:(.text+0x216): undefined reference to `lua_tointeger'
    build\src\lua\LuaSlider.o:LuaSlider.cpp:(.text+0x30c): undefined reference to `lua_tointeger'
    build\src\lua\LuaSlider.o:LuaSlider.cpp:(.text+0x3ed): undefined reference to `lua_pcall'
    build\src\lua\LuaTextbox.o:LuaTextbox.cpp:(.text+0x51c): undefined reference to `lua_pcall'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0x73a): undefined reference to `luaL_typerror'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0x8ee): undefined reference to `luaL_typerror'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0x97e): undefined reference to `lua_tointeger'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0x994): undefined reference to `lua_tointeger'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0xaa4): undefined reference to `lua_tointeger'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0xaba): undefined reference to `lua_tointeger'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0xbbc): undefined reference to `lua_pcall'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0xcd2): undefined reference to `lua_pcall'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0xdfd): undefined reference to `lua_pcall'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0xf16): undefined reference to `lua_pcall'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0x102c): undefined reference to `lua_pcall'
    build\src\lua\LuaWindow.o:LuaWindow.cpp:(.text+0x1142): more undefined references to `lua_pcall' follow
    build\src\lua\luascripts\eventcompat.lua.o:eventcompat.lua.cpp:(.text+0x31): undefined reference to `luaL_loadbuffer'
    build\src\lua\luascripts\eventcompat.lua.o:eventcompat.lua.cpp:(.text+0x54): undefined reference to `lua_pcall'
    build\src\lua\socket\socket.lua.o:socket.lua.cpp:(.text+0x31): undefined reference to `luaL_loadbuffer'
    build\src\lua\socket\socket.lua.o:socket.lua.cpp:(.text+0x4c): undefined reference to `lua_call'
    build\src\lua\socket\auxiliar.o:auxiliar.c:(.text+0x300): undefined reference to `luaL_typerror'
    build\src\lua\socket\buffer.o:buffer.c:(.text+0x187): undefined reference to `lua_tonumber'
    build\src\lua\socket\buffer.o:buffer.c:(.text+0x4e3): undefined reference to `lua_tonumber'
    build\src\lua\socket\buffer.o:buffer.c:(.text+0x821): undefined reference to `luaL_prepbuffer'
    build\src\lua\socket\except.o:except.c:(.text+0xd0): undefined reference to `lua_pcall'
    build\src\lua\socket\except.o:except.c:(.text+0x24b): undefined reference to `lua_pcall'
    build\src\lua\socket\options.o:options.c:(.text+0x204): undefined reference to `luaL_typerror'
    build\src\lua\socket\options.o:options.c:(.text+0x2df): undefined reference to `lua_tonumber'
    build\src\lua\socket\options.o:options.c:(.text+0x411): undefined reference to `luaL_typerror'
    build\src\lua\socket\select.o:select.c:(.text+0x351): undefined reference to `lua_call'
    build\src\lua\socket\select.o:select.c:(.text+0x37b): undefined reference to `lua_tonumber'
    build\src\lua\socket\select.o:select.c:(.text+0x42a): undefined reference to `lua_call'
    collect2.exe: error: ld returned 1 exit status

  • jacob1
    25th Feb 2019 Developer 0 Permalink
    If I had to guess, you deleted liblua5.1.a, or it can't find it. It needs this because it contains all the lua code that implements those functions. This library is in the MingwLibraries.zip in the guide.