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

Build of lldb is failing with SWIG 4.1.0 #2377

Closed
jplesnik opened this issue Sep 19, 2022 · 2 comments
Closed

Build of lldb is failing with SWIG 4.1.0 #2377

jplesnik opened this issue Sep 19, 2022 · 2 comments
Labels

Comments

@jplesnik
Copy link
Contributor

I am testing rebuild of SWIG dependencies against version 4.1.0 in Fedora rawhide/38.

The build of lldb-15.0.0 is failing with this version.

/builddir/build/BUILD/lldb-15.0.0.src/redhat-linux-build/bindings/python/LLDBWrapPython.cpp:22100:19: error: non-const lvalue reference to type 'lldb::FileSP' (aka 'shared_ptr<lldb_private::File>') cannot bind to a value of unrelated type 'SwigValueWrapper<std::shared_ptr<lldb_private::File>>'
    lldb::FileSP &sp = result;
                  ^    ~~~~~~
/builddir/build/BUILD/lldb-15.0.0.src/redhat-linux-build/bindings/python/LLDBWrapPython.cpp:22140:19: error: non-const lvalue reference to type 'lldb::FileSP' (aka 'shared_ptr<lldb_private::File>') cannot bind to a value of unrelated type 'SwigValueWrapper<std::shared_ptr<lldb_private::File>>'
    lldb::FileSP &sp = result;
                  ^    ~~~~~~
/builddir/build/BUILD/lldb-15.0.0.src/redhat-linux-build/bindings/python/LLDBWrapPython.cpp:22180:19: error: non-const lvalue reference to type 'lldb::FileSP' (aka 'shared_ptr<lldb_private::File>') cannot bind to a value of unrelated type 'SwigValueWrapper<std::shared_ptr<lldb_private::File>>'
    lldb::FileSP &sp = result;
                  ^    ~~~~~~
/builddir/build/BUILD/lldb-15.0.0.src/redhat-linux-build/bindings/python/LLDBWrapPython.cpp:30742:19: error: non-const lvalue reference to type 'lldb::FileSP' (aka 'shared_ptr<lldb_private::File>') cannot bind to a value of unrelated type 'SwigValueWrapper<std::shared_ptr<lldb_private::File>>'
    lldb::FileSP &sp = result;
                  ^    ~~~~~~
4 errors generated.

Complete build log is here.

@wsfulton
Copy link
Member

This is due to a change in SwigValueWraper for C++11 and later for improved move semantics in commit d1055f4, see #999.

A simple patch fixes it for lldb and is backwards compatible with older versions of SWIG.

-- lldb-15.0.0.src/bindings/python/python-typemaps.swig-original	2022-09-20 20:45:33.545145308 +0100
+++ lldb-15.0.0.src/bindings/python/python-typemaps.swig	2022-09-20 20:45:38.952152804 +0100
@@ -435,7 +435,7 @@ template <> bool SetNumberFromPyObject<d
 
 %typemap(out) lldb::FileSP {
   $result = nullptr;
-  lldb::FileSP &sp = $1;
+  const lldb::FileSP &sp = $1;
   if (sp) {
     PythonFile pyfile = unwrapOrSetPythonException(PythonFile::FromFile(*sp));
     if (!pyfile.IsValid())

@ojwb ojwb added the Python label Sep 21, 2022
@jplesnik
Copy link
Contributor Author

The patch helped. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants