<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Support SWIG 4.0"
href="https://bugs.llvm.org/show_bug.cgi?id=42284">42284</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Support SWIG 4.0
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>pyry.kontio@drasa.eu
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=22106" name="attach_22106" title="A Python wrapper generated by SWIG 4">attachment 22106</a> <a href="attachment.cgi?id=22106&action=edit" title="A Python wrapper generated by SWIG 4">[details]</a></span>
A Python wrapper generated by SWIG 4
The SWIG project released SWIG 4.0.0 on 2019-04-27. Some package managers such
as Homebrew rapidly included it as the default version. However, the current
interface files seem to generate broken wrappers with SWIG 4.
Having SWIG 4 installed and LLDB built using it, it errors like this:
$ echo "import lldb" > test_lldb.py
$ bin/lldb
(lldb) command script import test_lldb.py
Traceback (most recent call last):
File "<string>", line 1, in <module>
File
"/Users/kon/repos/llvm-project/build/lib/python2.7/site-packages/lldb/__init__.py",
line 1500, in <module>
class SBAddress(object):
File
"/Users/kon/repos/llvm-project/build/lib/python2.7/site-packages/lldb/__init__.py",
line 1675, in SBAddress
__swig_getmethods__["module"] = GetModule
NameError: name '__swig_getmethods__' 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 "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
error: module importing failed: No module named test_script.py
File "temp.py", line 1, in <module>
The important difference seems to be that SWIG 4 doesn't, by default, generate
dictionaries __swig_getmethods__ and __swig_setmethods__ to the objects.
Looking at the release notes, the passage "Python module overhaul by
simplifying the generated code and turning most optimizations on by default."
like the likely culprit.
I'm going to ask about the recommended way to migrate on the SWIG users mailing
list, but if someone knows a good fix, please reply.
Some projects such as Rust's LLDB support were already regressed by accidental
upgrade to SWIG 4. ( <a href="https://github.com/rust-lang/rust/pull/61827">https://github.com/rust-lang/rust/pull/61827</a> ) It would be
great if LLDB could quickly support the 4.x series.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>