Skip to content

[lldb] tests errors ModuleNotFoundError: No module named '_lldb' with BuildType=Debug on Windows  #87381

Closed
@amordo

Description

@amordo

For example

C:\Users\iammorjj\llvm-project\build>python_d bin/lldb-dotest -p TestAddressBreakpoints.py
C:\Program Files\Python312\python_d.exe C:/Users/iammorjj/llvm-project/lldb/test/API/dotest.py --arch x86_64 --build-dir C:/Users/iammorjj/llvm-project/build/lldb-test-build.noindex --executable C:/Users/iammorjj/llvm-project/build/./bin/lldb.exe --compiler C:/Users/iammorjj/llvm-project/build/./bin/clang.exe --dsymutil C:/Users/iammorjj/llvm-project/build/./bin/dsymutil.exe --lldb-libs-dir C:/Users/iammorjj/llvm-project/build/./lib --llvm-tools-dir C:/Users/iammorjj/llvm-project/build/./bin -p TestAddressBreakpoints.py
lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision ee99475068523de185dce0a449b65e684a1e6b73)
  clang revision ee99475068523de185dce0a449b65e684a1e6b73
  llvm revision ee99475068523de185dce0a449b65e684a1e6b73
Traceback (most recent call last):
  File "C:\Users\iammorjj\llvm-project\build\Lib\site-packages\lldb\__init__.py", line 39, in <module>
    import _lldb
ModuleNotFoundError: No module named '_lldb'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\iammorjj\llvm-project\lldb\test\API\dotest.py", line 8, in <module>
    lldbsuite.test.run_suite()
  File "C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\dotest.py", line 946, in run_suite
    import lldb
  File "C:\Users\iammorjj\llvm-project\build\Lib\site-packages\lldb\__init__.py", line 42, in <module>
    from . import _lldb
ImportError: cannot import name '_lldb' from partially initialized module 'lldb' (most likely due to a circular import) (C:\Users\iammorjj\llvm-project\build\Lib\site-packages\lldb\__init__.py)

C:\Users\iammorjj\llvm-project\build>

It doesn't work neither with python nor python_d.
Adding _d solves the problem (rename from "C:\Users\iammorjj\llvm-project\build\lib\site-packages\lldb\_lldb.cp312-win_amd64.pyd" to "C:\Users\iammorjj\llvm-project\build\lib\site-packages\lldb\_lldb_d.cp312-win_amd64.pyd").

C:\Users\iammorjj\llvm-project\build>python_d bin/lldb-dotest -p TestAddressBreakpoints.py
C:\Program Files\Python312\python_d.exe C:/Users/iammorjj/llvm-project/lldb/test/API/dotest.py --arch x86_64 --build-dir C:/Users/iammorjj/llvm-project/build/lldb-test-build.noindex --executable C:/Users/iammorjj/llvm-project/build/./bin/lldb.exe --compiler C:/Users/iammorjj/llvm-project/build/./bin/clang.exe --dsymutil C:/Users/iammorjj/llvm-project/build/./bin/dsymutil.exe --lldb-libs-dir C:/Users/iammorjj/llvm-project/build/./lib --llvm-tools-dir C:/Users/iammorjj/llvm-project/build/./bin -p TestAddressBreakpoints.py
lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision ee99475068523de185dce0a449b65e684a1e6b73)
  clang revision ee99475068523de185dce0a449b65e684a1e6b73
  llvm revision ee99475068523de185dce0a449b65e684a1e6b73
C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\lldbplatformutil.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import packaging
Skipping the following test categories: ['libc++', 'libstdcxx', 'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']
C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py:1520: SyntaxWarning: invalid escape sequence '\l'
  "LD_EXTRAS": "-shared -l%s\liblldb.lib" % lib_dir,
C:\Users\iammorjj\llvm-project\lldb\packages\Python\lldbsuite\test\decorators.py:1094: SyntaxWarning: invalid escape sequence '\s'
  if re.match("%s: 1\s*" % feature, output):
PASS: LLDB (C:\Users\iammorjj\llvm-project\build\bin\clang.exe-x86_64) :: test_address_breakpoints (TestAddressBreakpoints.AddressBreakpointTestCase.test_address_breakpoints)
----------------------------------------------------------------------
Ran 1 test in 4.053s

OK
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='C:\\Users\\iammorjj\\llvm-project\\build\\lldb-test-build.noindex\\functionalities\\breakpoint\\address_breakpoints\\TestAddressBreakpoints.test_address_breakpoints\\Incomplete.log' mode='w' encoding='utf-8'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed file <_io.BufferedRandom name='C:\\Users\\iammorjj\\AppData\\Local\\Temp\\tmphalkqt2u'>

C:\Users\iammorjj\llvm-project\build>

PS: seems it's regression after
ae389b2#diff-644df201b5e726af9435d4fd88f8f43924506062add78fff02d4dca4fb8f98d7R152
set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb${LLDB_PYTHON_EXT_SUFFIX}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions