i686-mingw: texlua.exe FFI module not working
Hi, I had been trying to compile TexLive on MINGW compilers on Windows provided by MSYS2[0] project. See this PR[1]. It was only for i686-mingw. x86-64-mingw worked without any problems. I found that there was Segmentation Fault(or crash) when running the `runscript.exe` the launchers which TexLive provides on Windows and I could see it uses LuaTeX. You can find the source here[2]. What is essentially does is calls the `texlua.exe` with `runscript.tlu` passed it in. I initially thought it was a problem with compiled version of the launcher itself, but it wasn't it, it was a problem with `texlua.exe`. `runscript.exe` just returns the code returned from `texlua.exe` and the return code was a crash and there is a popup which say the program isn't working correctly and crashed at `ntdll.dll`. While just running `texlua.exe` on a normal hello world lua script[3] works without any crash or error. So, I thought something from the code in `runscript.tlu`[4] should be causing this issue. I don't know how to debug a lua script, so my plan was to randomly place print statements (you know that is the easiest and best way to debug something), and whether it printed or not. I first looked over the `runscript.tlu` to see if there are parts of code which could crash the interpreter and I found this block of code[5] which uses ffi module. Now I placed print statements before and after local runscripthandle = ffi.C.GetModuleHandleA("runscript.dll") and found that the one before was printed and `texlua.exe` crashed. So it is something related to ffi module. I tried the same with `texluajit.exe` and it seemed to work. What I did to make the launchers work was to patch this [6] and it worked without any problem. But that isn't the actual fix the Crash in `texlua.exe` on using ffi module in `i686-mingw`. I hope anybody will help me fix this. For the version, I am building TexLive with this `ccb6338507149edf2772bfccb9933b72761f4cc4` commit on GitHub or `svn://tug.org/texlive/trunk/Build/source@58686`. Best, Naveen [0]: https://www.msys2.org [1]: https://github.com/msys2/MINGW-packages/pull/8271 [2]: https://github.com/TeX-Live/texlive-source/blob/9bad8358d2f98a8bed86ecfa238d... [3]: https://www.lua.org/pil/1.html [4]: https://github.com/TeX-Live/texlive-source/blob/9bad8358d2f98a8bed86ecfa238d... [5]: https://github.com/TeX-Live/texlive-source/blob/9bad8358d2f98a8bed86ecfa238d... [6]: https://github.com/msys2/MINGW-packages/blob/3e2204b3fa18cd967b7aa616dfef9e2...
On Wed, Apr 28, 2021 at 7:58 AM Naveen M K
Hi,
I had been trying to compile TexLive on MINGW compilers on Windows provided by MSYS2[0] project. See this PR[1]. It was only for i686-mingw. x86-64-mingw worked without any problems.
I found that there was Segmentation Fault(or crash) when running the `runscript.exe` the launchers which TexLive provides on Windows and I could see it uses LuaTeX. You can find the source here[2]. What is essentially does is calls the `texlua.exe` with `runscript.tlu` passed it in. I initially thought it was a problem with compiled version of the launcher itself, but it wasn't it, it was a problem with `texlua.exe`.
Thank you for the report, I will see it this weekend. -- luigi
participants (2)
-
luigi scarso
-
Naveen M K