Trouble running Python tests on Windows

Hi,

I can’t seem to run the lldb python tests on my Windows 10 setup. I use the following cmd-line to generate:

cmake -G Ninja f:/svn/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_OPTIMIZED_TABLEGEN=true -DLLVM_EXTERNAL_LLD_SOURCE_DIR=f:/svn/lld -DLLVM_EXTERNAL_CLANG_SOURCE_DIR=f:/svn/clang -DLLVM_TOOL_LLD_BUILD=true -DLLVM_TOOL_CLANG_BUILD=true -DLLVM_ENABLE_PDB=true -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_EXTERNAL_LLDB_SOURCE_DIR=f:/svn/lldb -DLLVM_TOOL_LLDB_BUILD=true -DPYTHON_HOME=“C:\Users\aganea\AppData\Local\Programs\Python\Python37”

Followed by: ninja check-all, which ends up in a bunch of:

******************** TEST ‘lldb-Suite :: tools/lldb-server/TestAppleSimulatorOSType.py’ FAILED ********************

Unable to find ‘RESULT: PASSED’ in dotest output:

lldb version 9.0.0 (https://aganea@llvm.org/svn/llvm-project/lldb/trunk revision 361826)

clang revision 361826

llvm revision 361826

LLDB library dir: F:\svn\buildninja\bin

LLDB import library dir: F:\svn\buildninja\bin..\lib

Traceback (most recent call last):

File “F:/svn/lldb/test/dotest.py”, line 7, in

lldbsuite.test.run_suite()

File “F:\svn\lldb\packages\Python\lldbsuite\test\dotest.py”, line 1243, in run_suite

import lldb

File “F:\svn\buildninja\lib\site-packages\lldb_init_.py”, line 1500, in

class SBAddress(object):

File “F:\svn\buildninja\lib\site-packages\lldb_init_.py”, line 1675, in SBAddress

swig_getmethods[“module”] = GetModule

NameError: name ‘swig_getmethods’ is not defined

Swig 4.0.0 is there in %PATH%. I’m using MSVC 19.16.27031.1 for compiling. I’ve tried with Clang 8.0, same issues.

Any idea on what could be missing?

Thanks in advance!

Alex.

+ Stella/Pavel

Run the cmake gui, and point it to the correct source and build directories. Look for key “SWIG_EXECUTABLE”. If it doesn’t exist, set it to your swig exe. Mine is C:/swigwin-3.0.12/swig.exe , for example. If you change it, hit the configure and then generate buttons, then rebuild and rerun the tests.

I haven’t built with swig 4, just swig 3. I’ll let someone else answer if swig 4 works!

I can confirm that there are problems building with Swig 4.

I’ve also just found that there’s a bug in versions of Swig before 4 that makes the code it generates incompatible with Python 3.7. (See lldb-dev@ for a message I just sent out about this.)

Python 3.6 with Swig 3.0.12 is working well for me on Windows.

The bug that makes swig before 4 fail with Python 3.7 may turn into a big issue, given that swig is now licensed under GPL v3. I believe Apple has said in the past that they can’t move past a certain version of swig 2.x, since the license changed from GPL v2 to GPL v3.

I believe that problem has already arrived, as there is no GPL v2 swig that can target any version of python3, much less python 3.7.

pl