3

During the past weeks I was wandering around for a problem with QtCreator and LLDB v9, when I started the debug process, an exception of the ubuntu system exception arose, the exception dialog informed that No module named _lldb, and the debugging process within QtCreator hungs up.

The configuration of my system is:

  • Ubuntu 19.10 x64
  • Qt 5.14.1
  • Qt Creator 4.11
  • lldb-9
  • python-lldb-9

At the beginning, I thought that there was a problem with lldb-9, because when I used lldb-7 there was not problem, and for that reason I decided to debug manually my program, and guess what, lldb-9 worked swiftly debugging my program under console.

Then, I thought that the problem has to be python, then I installed python3-lldb-9, but nothing changed.

1 Answers1

3

Doing an internet research, I found this post: How to import lldb in a python script. That post showed me that the very python does not load the lldb module due that module was designed to run within lldb command line. But for sure, QtCreator needs it in order to run lldb properly.

Finally, running lldb -P command, I found the solution. You need to make two missing symlinks, this way:

Go to your python-lldb version, in my case is:

cd /usr/lib/llvm-9/lib/python3.7/site-packages/lldb

Then, create the symbolic link to liblldb.so.1 with python-like module name:

sudo ln -sf ../../../liblldb.so.1 _lldb.so

In my experience, there is no need to link more libraries within that directory.

Finally, command lldb -P shows the alias for --python-path del LLDB, that in my case is:

/usr/lib/x86_64-linux-gnu/python3.7/site-packages

But, that directory does not exist. So, you need to create a new symlink:

cd /usr/lib/x86_64-linux-gnu/
mkdir python3.7
ln -sf /usr/lib/llvm-9/lib/python3.7/site-packages/ site-packages

Make sure that you have the python version properly selected in QtCreator options, and try to debug within QtCreator.

Note: if you want to import lldb module within the python3 shell, you have to export the python path like this:

export PYTHONPATH='/usr/lib/llvm-9/lib/python3.7/site-packages'

Maybe this approach works for python2.7, I find this solution easy, and maybe this is an Ubuntu 19.10 bug related with lldb-9 and python-lldb packages, don't know, but if any of you have a clue about this, I appreciate additional info.

  • don't forget to install `sudo apt install python3-lldb-9`. Without it I got an error `ModuleNotFoundError: No module named 'lldb'` – Ivan Kush Jun 13 '20 at 22:42