Hi, I've followed the sparse instructions you provided pretty carefully, but the source code build is failing and not working!

I'm using MinGW-w64 V11.2.0 on Windows 11 and mingw32-make.exe for the x64 platform build of the LuaRT V1.0.2 source code.

As I understand the instructions, just run make under the \src directory and it should all work, right?

What happens for me, however, is the build runs apparently flawless and creates these binaries in the \bin directory:

lua54.dll
luart.exe
luart-static.exe
wluart.exe
wluart-static.exe

The make however then fails with this error:

Compiling rtc.exe...
mingw32-make: *** [Makefile:168: rtc] Error -1073741819

Furthermore, the only one of the binaries that I did get which seems to actually work is luart-static.exe. The others just do nothing when I run them!

Any clue what I am doing wrong here or what needs to be done to fix this? I'd like to get a fully working version of all of LuaRT so I can add features and hopefully contribute to the project! Please someone help me get my build environment described here working.

Hi Rsupreme4,

Welcome to LuaRT Community.
Build problems may be related to many factors.
It may be related to the MinGW-w64 version of the GCC compiler, and to the distribution used (like TDM-GCC, winlibs, nuwen distribution...)

For my part I use MinGW-w64 8.1.0 from [Login to see the link]

You should check this thread too (especially the last post for more recent GCC versions) : [Login to see the link]

I'm working on a better compiler compatibility, but it's very hard as there are so many different GCC compiler versions !

I have found the problem.
It seems that Link Time Optimisation is failing using Mingw-w64 with GCC >= 11.0.0

I will commit the new Makefile.
Until then, you just can suppress the "-flto=auto" flag in all the Makefile.

Hi Samir!

Thanks for looking into the build issues. I downgraded my MingW-W64 to V8.1.0 and it still didn't work until I removed -flto=auto. The luart.exe and wluart.exe now work. Even, the build still fails trying to make rtc.exe, though the error now is a little different and looks much better!

Compiling rtc.exe...
cannot open ..\tools\rtc\src\rtc.lua: No such file or directory
mingw32-make: *** [Makefile:168: rtc] Error 1

mingw32-make clean also does not work:

--------------------------------- Building for Windows x64 Platform
mingw32-make: *** [Makefile:202: clean] Error 267

Honestly, I don't think you should have to worry about supporting all different versions of GCC and other compilers. What we really need to know is which distro and what version of GCC is the source supposed to be built with? Because anybody like me looking to contribute the project really needs to be using the same build environment for any changes to work for you too!

Also, even after I get these build issues resolved, it would really be helpful if there was a pinned thread here or some discussion in the readme.md file to explain how the code is structured. You have a lot of macros like LUA_METHOD() and LUA_PROPERTY_GET(), etc, but how are these supposed to be properly registered so the script language knows the call signature and arguments correctly? I can probably figure it out eventually, but there is very little commenting in the code to explain this, so it is a bit of detective work for me right now.

    RSupreme4 the error now is a little different and looks much better!

    RSupreme4 mingw32-make clean also does not work:

    Both errors came to the fact you don't have the rtc subproject source files.
    You must have downloaded the ZIP archive from the Github repository, which does not download the submodules (rtc, QuickRT and LuaRT Studio). You have several options to do that :

    • Either download the ZIP archive from the rtc repository from Github and extract it to the tools\ directory.
    • You can clone the repository with git including the subprojects (or use an IDE that support git, as vscode)

    See this post on StackOverflow for more precisions : [Login to see the link]

    RSupreme4 it would really be helpful if there was a pinned thread here or some discussion in the readme.md file to explain how the code is structured.

    You are totally right ! But there aren't enough days in the week! 😄
    For now, I concentrated on documenting LuaRT's different modules and features.

    I'm just working on tutorials for extending LuaRT with binary modules that will cover the LuaRT C API

    Update :

    • Commit for the makefile has been published
    • I've added rtc sources detection to thrown an error if the repository has not been git cloned
    5 days later

    Hi Samir -
    Ok, that explains a lot! I was using just a downloaded .zip of the main LuaRT and did not include the other sub-repos (something I didn't even know existed!). I chose the GIT route, but you need to use "git clone --recursive" to make it pull down the sub-repos too. After that, build worked except when using your new Makefile, something seems to be wrong interpreting the new lines that you added:
    ifeq (,$(wildcard ../tools/rtc/src/rtc.lua))
    $(error rtc sources not found. Go to https://github.com/samyeyo/rtc or clone rtc repository in the tools\rtc\ folder)
    endif

    I'm not sure why, but it seems that ifeq statement isn't being interpreted as a conditional statement but rather as an execution. I'm new to Makefile, so the problem may be more obvious to someone else here.

      RSupreme4 it seems that ifeq statement isn't being interpreted

      You're right, it might be due to indentation. I will check this.
      Thank you for the report !

      Powered by: FreeFlarum.
      (remove this footer)