Fedora Account System
Red Hat Associate
Red Hat Customer
Description of problem: LLDB does not working in a virtual environment. Version-Release number of selected component (if applicable): 20.1 fedora 42. How reproducible: $ python -m venv venv $ source ./venv/bin/activate $ lldb Actual results: LLDB starts with python error of missing modules ```sh Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'lldb.embedded_interpreter' Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "/home/da-viper/Dev/contribute/llvm-project/llvm/utils/lldbDataFormatters.py", line 14, in __lldb_init_module debugger.HandleCommand("type category define -e llvm -l c++") ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'SwigPyObject' object has no attribute 'HandleCommand' swig/python detected a memory leak of type 'lldb::SBDebugger *', no destructor found. Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'lldb' is not defined ``` Expected results: LLDB lauches fine. Additional info: After reading the LLVM.spec file i think this is caused by the line ``` %if %{without compat_build} # Move python package out of llvm prefix. mkdir -p %{buildroot}%{python3_sitearch} mv %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version}/site-packages/lldb %{buildroot}/%{python3_sitearch} rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version}/site-packages rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version} ``` Since it is moved to the default site packages on the OS, when we create a virtual environment the site packages that is checked is overridden, Then it will not find the required module. file spec link https://src.fedoraproject.org/rpms/llvm/blob/rawhide/f/llvm.spec This is not in set in Fedora 41 branch
I think the location on f41 is the same, it's just that it gets there in a different way. On f41 it was directly installed there, on f42 we first install to a different path and then move it. The lldb binary itself will be in a different location though, maybe that makes a difference?
I confirmed that f41 and rawhide are indeed installing python files in the same location. The problem appears to be in lldb itself. On Rawhide we have: $ lldb -P /usr/lib64/llvm20/lib64/python3.13/site-packages While on f41: $ lldb -P /usr/lib64/python3.13/site-packages
While this is investigated/fixed, the following might help as a workaround: PYTHONPATH=/usr/lib64/python3.13/site-packages lldb
This has been fixed a while ago as part of (mostly) undoing the prefix changes. Tested in https://src.fedoraproject.org/tests/llvm/pull-request/55.