Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvmPackages_{15,16,17}.lldb: broken, "ModuleNotFoundError: No module named 'lldb'" #166604

Closed
dtzWill opened this issue Mar 31, 2022 · 12 comments · Fixed by #252015
Closed

llvmPackages_{15,16,17}.lldb: broken, "ModuleNotFoundError: No module named 'lldb'" #166604

dtzWill opened this issue Mar 31, 2022 · 12 comments · Fixed by #252015
Labels
0.kind: bug 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related

Comments

@dtzWill
Copy link
Member

dtzWill commented Mar 31, 2022

Describe the bug

lldb from llvmPackages_14.lldb seems to be broken, reporting:

$ lldb --version
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb'
lldb version 14.0.0

This error is present in all invocations of lldb I've tried: with no arguments, pointed at an executable, and debugging a coredump (SYSTEMD_DEBUGGER=lldb for coredumpctl debug(/gdb), FWIW).

Coredump usage is worse, with something like:

$ coredump debug
...<<snip>>...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb'
(lldb) target create "<<redacted>>" --core "/var/tmp/coredump-VXmhXt"
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

Core file '/var/tmp/coredump-VXmhXt' (x86_64) was loaded.
(lldb)

Steps To Reproduce

Steps to reproduce the behavior:

  1. lldb --version or other lldb invocations, until this is fixed this works: nix run nixpkgs#llvmPackages_14.lldb -- --version.
  2. Note the messages as described above

Expected behavior

LLDB doesn't show this error, and presumably whatever functionality triggering this isn't working properly but I haven't tried using it after the error(s) are printed.

Additional context

Another LLVM14 package to fix before this is ready for use:

cc #165701

Notify maintainers

@lovek323 @7c6f434c @dtzWill @primeos

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.17.0, NixOS, 22.05 (Quokka), 22.05pre364898.00e27c78d3d`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.0pre20220330_2252272`
 - channels(will): `""`
 - channels(root): `"home-manager, nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@dtzWill
Copy link
Member Author

dtzWill commented Mar 31, 2022

Hmm, seems the packaging of the python bits is broken.

We expect python bits to all be in the "lib" output. We wrap lldb to find its python bits in .lib and even check for presence of some python files in that output during installCheckPhase.

However, all the python bits end up in the primary output, which is probably why this is broken. Hmm.

EDIT: okay, the installCheckPhase isn't running, since checks aren't enabled by default (:disappointed:), but we can set doInstallCheck = true. I'll make a pass for this in a bit...

So main thing is just convincing LLDB to install its python bits where we expect them (or move them, etc.).

@dtzWill
Copy link
Member Author

dtzWill commented Apr 1, 2022

Also, the file we check for is _lldb.so which is no longer installed. See ae389b2450bd604a3f3bbe5b09b333b2d99801dd .

The gnu-install-dirs.patch from LLVM13 has python bits which apply (with offsets), maybe they're still needed?

cc @Ericson2314 (thanks, sorry!).

@dtzWill
Copy link
Member Author

dtzWill commented Apr 1, 2022

WIP fix, discussed here: #166730 (comment) .

dtzWill added a commit to dtzWill/nixpkgs that referenced this issue Apr 6, 2022
Throws errors on startup, see NixOS#166604.

Should be marked broken but fixes in the works.
dtzWill added a commit to dtzWill/nixpkgs that referenced this issue Apr 6, 2022
Throws errors on startup, see NixOS#166604 for same with LLVM14.

Should be marked broken, but fixes in the works.
@NickHu
Copy link
Contributor

NickHu commented Sep 13, 2022

@dtzWill Any chance you could PR your WIP fix? Even if it's not perfect, it's better than the current state of LLDB 14 in nixpkgs.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/lldb-not-working/24567/2

@Ninja3047
Copy link
Contributor

This still seems to be an issue for lldb_15

PYTHONPATH=${PYTHONPATH:+':'$PYTHONPATH':'}
PYTHONPATH=${PYTHONPATH/':''/nix/store/fdxcc2gx0hz56ik22yv4awjvhacgni5d-lldb-15.0.7-lib/lib/python3.10/site-packages/'':'/':'}
PYTHONPATH='/nix/store/fdxcc2gx0hz56ik22yv4awjvhacgni5d-lldb-15.0.7-lib/lib/python3.10/site-packages/'$PYTHONPATH
PYTHONPATH=${PYTHONPATH#':'}
PYTHONPATH=${PYTHONPATH%':'}
export PYTHONPATH

the wrapper sets the PYTHONPATH to /nix/store/fdxcc2gx0hz56ik22yv4awjvhacgni5d-lldb-15.0.7-lib/lib/python3.10/site-packages/

which does not actually exist

The path it it should be looking for is /nix/store/fdxcc2gx0hz56ik22yv4awjvhacgni5d-lldb-15.0.7-lib/lib/python3.10/site-packages/. This directory has the following content.

total 712
dr-xr-xr-x 5 root root   4096 Dec 31  1969 .
dr-xr-xr-x 3 root root   4096 Dec 31  1969 ..
-r--r--r-- 2 root root   4032 Dec 31  1969 embedded_interpreter.py
dr-xr-xr-x 3 root root   4096 Dec 31  1969 formatters
-r--r--r-- 2 root root 700563 Dec 31  1969 __init__.py
lrwxrwxrwx 3 root root     30 Dec 31  1969 lldb-argdumper -> ../../../../bin/lldb-argdumper
lrwxrwxrwx 6 root root     19 Dec 31  1969 _lldb.cpython-310-x86_64-linux-gnu.so -> ../../../liblldb.so
dr-xr-xr-x 2 root root   4096 Dec 31  1969 plugins
dr-xr-xr-x 2 root root   4096 Dec 31  1969 utils

The symlink for _lldb.cpython-310-x86_64-linux-gnu.so is broken and points to /nix/store/y6i9rrhcp4y64y1zwlisg0d6z7hz7z4z-lldb-15.0.7/lib/liblldb.so. The correct file is located at /nix/store/fdxcc2gx0hz56ik22yv4awjvhacgni5d-lldb-15.0.7-lib/lib/liblldb.so.

There seems to be some kind of mixup between /nix/store/fdxcc2gx0hz56ik22yv4awjvhacgni5d-lldb-15.0.7-lib and /nix/store/y6i9rrhcp4y64y1zwlisg0d6z7hz7z4z-lldb-15.0.7.

@andrewrk
Copy link
Member

Is there a workaround?

@schuelermine
Copy link
Contributor

This seems to be fixed?
image

@andrewrk
Copy link
Member

Not fixed

andy@ark ~> nixos-version
23.05.3580.5d017a8822e0 (Stoat)
andy@ark ~> nix-shell -p lldb_16

[nix-shell:~]$ lldb
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb'
(lldb) 

@schuelermine
Copy link
Contributor

Hm, I’m getting an even more egregious error with 16. I think this issue is about 14 though, which doesn’t have this issue for me. (I’m using nixos-unstable)

~$ nixos-version
23.11.20230914.f2ea252 (Tapir)
~$ nix shell nixpkgs#lldb_16
~$ lldb
/nix/store/7ryjyq988rgag5rin91fa4v5807gyq61-lldb-16.0.6/bin/lldb: error while loading shared libraries: libclang-cpp.so.16: cannot open shared object file: No such file or directory
~ [127]$ 

@schuelermine
Copy link
Contributor

15 has the module not found error, though, for me

@andrewrk
Copy link
Member

what I really want is lldb 17

@wegank wegank changed the title llvmPackages_14.lldb: broken, "ModuleNotFoundError: No module named 'lldb'" llvmPackages_{15,16,17}.lldb: broken, "ModuleNotFoundError: No module named 'lldb'" Dec 21, 2023
@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants