LjTools icon indicating copy to clipboard operation
LjTools copied to clipboard

Build issues

Open tritao opened this issue 8 months ago • 4 comments

Installed distro Lua and LuaJIT dev packages: sudo apt install liblua5.1-dev libluajit2-5.1-dev

Running qmake as instructed:

$ qmake LjBcViewer.pro
Cannot read Lj/LuaJIT/src/LuaJit.pri: No such file or directory

OK, after patching that out with:

diff --git a/LjBcViewer.pro b/LjBcViewer.pro
index ad1a3c7..169ad7e 100644
--- a/LjBcViewer.pro
+++ b/LjBcViewer.pro
@@ -52,11 +52,7 @@ HEADERS  += LjBcViewerMain.h \
     LjDisasm.h \
     StreamSpy.h
 
-include( ../LuaJIT/src/LuaJit.pri ){
-    LIBS += -ldl
-} else {
-    LIBS += -lluajit
-}
+LIBS += -lluajit
 
 linux {
     QMAKE_LFLAGS += -rdynamic

Now I get with make:

Engine2.cpp:20:10: fatal error: lua.hpp: No such file or directory
   20 | #include <lua.hpp>
      |          ^~~~~~~~~
compilation terminated.
make: *** [Makefile:595: Engine2.o] Error 1
make: *** Waiting for unfinished jobs....
ExpressionParser.cpp:28:10: fatal error: lua.hpp: No such file or directory
   28 | #include <lua.hpp>
      |          ^~~~~~~~~
compilation terminated.
make: *** [Makefile:606: ExpressionParser.o] Error 1
Terminal2.cpp:39:10: fatal error: lua.hpp: No such file or directory
   39 | #include <lua.hpp>
      |          ^~~~~~~~~
compilation terminated.
make: *** [Makefile:602: Terminal2.o] Error 1
LuaJitBytecode.cpp:24:10: fatal error: lj_bc.h: No such file or directory
   24 | #include <lj_bc.h>
      |          ^~~~~~~~~
compilation terminated.
LuaJitEngine.cpp:23:10: fatal error: lj_bc.h: No such file or directory
   23 | #include <lj_bc.h>
      |          ^~~~~~~~~

The distro package provides:

/usr/include/luajit-2.1/lauxlib.h
/usr/include/luajit-2.1/lua.h
/usr/include/luajit-2.1/lua.hpp
/usr/include/luajit-2.1/luaconf.h
/usr/include/luajit-2.1/luajit.h
/usr/include/luajit-2.1/lualib.h
/usr/lib/x86_64-linux-gnu/libluajit-5.1.a
/usr/lib/x86_64-linux-gnu/libluajit-5.1.so
/usr/lib/x86_64-linux-gnu/pkgconfig/luajit.pc
/usr/share/doc/libluajit-5.1-dev/changelog.Debian.gz
/usr/share/doc/libluajit-5.1-dev/copyright

tritao avatar May 04 '25 12:05 tritao

Do I need this LuaJIT/src/LuaJit.pri project?

tritao avatar May 04 '25 12:05 tritao

Yes, you need the LuaJit.pri; you need even a custom version of LuaJIT if you want to make use of all features of the LjTools debugger. I just compiled LjBcViewer.pro on my machine and it worked. It's easiest if you download my LuaJIT version from here: https://github.com/rochus-keller/LuaJIT/archive/refs/heads/LjTools.zip. I should update the LjTools readme which I wrote long before I had all the tools depending on it. Instead have e.g. a look at https://github.com/rochus-keller/Luon#how-to-build which is pretty representative also for your case.

rochus-keller avatar May 04 '25 14:05 rochus-keller

Yes, you need the LuaJit.pri; you need even a custom version of LuaJIT if you want to make use of all features of the LjTools debugger. I just compiled LjBcViewer.pro on my machine and it worked. It's easiest if you download my LuaJIT version from here: rochus-keller/LuaJIT@refs/heads/LjTools.zip. I should update the LjTools readme which I wrote long before I had all the tools depending on it. Instead have e.g. a look at rochus-keller/Luon#how-to-build which is pretty representative also for your case.

Cool, that's what I was missing. I even searched for a repository with that name in your GitHub profile, but weirdly it does not show up for me, even though its public.

Now I got it to compile, but its crashing on startup.

I tried to debug it:

qmake CONFIG+=debug LjBcViewer.pro 
make
./LjBcViewer 
Segmentation fault (core dumped)
file ./LjBcViewer 
./LjBcViewer: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2927fdc41e881e46dcaf2f410e49f730ac5d933d, for GNU/Linux 3.2.0, with debug_info, not stripped
gdb -q ./LjBcViewer 
Reading symbols from ./LjBcViewer...
(gdb) r
Starting program: /home/joao/dev/Lj/LjTools/LjBcViewer 
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libQt5PrintSupport.so.5
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libQt5Gui.so.5
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libglib-2.0.so.0
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libbrotlidec.so.1
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libbrotlicommon.so.1
warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libcap.so.2
[New Thread 0x7ffff2e006c0 (LWP 862472)]
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libgdk-3.so.0
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libgobject-2.0.so.0
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libgmodule-2.0.so.0
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0
warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libxapp-gtk3-module.so
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libxapp.so.1
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libgnomekbdui.so.8
warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libgnomekbd.so.8
warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so
warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/gvfs/libgvfscommon.so
[New Thread 0x7ffff10006c0 (LWP 862473)]
[New Thread 0x7fffe3e006c0 (LWP 862474)]
[New Thread 0x7fffebe006c0 (LWP 862475)]
warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so

Thread 1 "LjBcViewer" received signal SIGSEGV, Segmentation fault.
0x00005555556985f0 in lj_vm_cpcall ()
(gdb) bt
#0  0x00005555556985f0 in lj_vm_cpcall ()
(gdb) 

Not sure where to go from here, seems to crash inside LuaJIT.

This is on Ubuntu 22.04 based system.

tritao avatar May 04 '25 23:05 tritao

This is strange. You are on an x64 system; can you check that the LuaJIT build process actually generated x64 binaries? I built Luon on the latest Debian on x64 which essentially includes all LjTools parts you try to compile, but I used LeanQt, not the original Qt. What do you intend to do with LjBcViewer? I could create a BUSY build file for it so you could try to compile it with LeanQt. You could then also use LeanCreator to debug it if the crash persists.

rochus-keller avatar May 05 '25 00:05 rochus-keller