Search code examples
cclanglldb

Can't get LLDB to run my executable correctly


recently i decided to experiment with clang and it works. (that is not the problem)
BUT i got an floating point when i tried to run it. i searched the clang debugger
and got LLDB, went to installed it (lldb-14-dev and liblldb-dev via synaptic)
maybe i am missing some. probably when i try running it (lldb ./out/roguelike launch) this is what i get:

clang -Wall -Werror -lm *.c -o out/roguelike `sdl2-config --cflags --libs` -lm
lldb .out/roguelike launch
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb.embedded_interpreter'
(lldb) target create ".out/roguelike"
error: unable to find executable for '.out/roguelike'

this is likely because i missed some lldb thing or forgot some argument (unfortunate)
but i don't know it for certain. tho if it matters (not likely) here is my makefile:

CC = clang

lazy_compile:
    $(CC) -Wall -Werror -lm *.c -o out/roguelike `sdl2-config --cflags --libs` -lm

lazy_test: lazy_compile
    ./out/roguelike

compile:
    $(CC) -O3 -Os -static *.c -o out/roguelike `sdl2-config --cflags --libs` -lm

debug: lazy_compile
    lldb .out/roguelike launch

run: compile
    ./out/roguelike

i tried to fiddle around with some packages but it didn't work,
and i can't understand most of the tutorials on how to use lldb
so i don't really know what it is, specially the last line


Solution

  • You can launch lldb with

    lldb out/roguelike launch
    

    or

    lldb ./out/roguelike launch
    

    but not with

    lldb .out/roguelike launch
    

    Also, not an error but you are including -lm twice.

    And yes, what HolyBlackCat says in comments: Provide debug info, just replace your first -lm (linking flags should be placed at the end of the toolchain) with -g and it should work.