[lldb-dev] [Bug 38974] New: lldb links with system Python library but runs Python from PATH

via lldb-dev lldb-dev at lists.llvm.org
Mon Sep 17 03:53:55 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38974

            Bug ID: 38974
           Summary: lldb links with system Python library but runs Python
                    from PATH
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: tdhutt at gmail.com
                CC: llvm-bugs at lists.llvm.org

See https://stackoverflow.com/q/47658596/265521 especially the comments to this
answer: https://stackoverflow.com/a/47658597/265521

Basically Python 2 on OSX is kind of a mess (like Python everywhere really).
OSX always comes with an installation of Python 2, but it is often an old
version, doesn't have pip, etc. For this reason a lot of people like to install
a copy of Python 2 from brew. Unfortunately that means you then have two copies
of Python 2.

LLVM always links with the system Python 2 framework, but when it runs the
Python 2 executable it finds it from PATH, which probably is the one from brew.
This causes an error:

    ImportError: cannot import name _remove_dead_weakref

A crappy workaround is to hack PATH when you run lldb, or to uninstall brew's
Python 2.

A proper solution is either:

1. Hard-code LLDB to always run `/usr/bin/python` on OSX since that's the one
it linked with.

2. Get LLDB to load the framework based on where Python says it is (e.g. from
`sysconfig.get_config_var("LIBDIR")` - see
https://stackoverflow.com/questions/47423246/get-pythons-lib-path )

I think the former solution is much easier and possibly more correct - you
probably don't want to link against one Python framework at compile time and
then run it with another at runtime. Maybe OSX can handle versioning properly
in that case though, I don't know.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180917/90cddc58/attachment.html>


More information about the lldb-dev mailing list