[Bug 25446] New: lldb Python extension module is linked to libpython

Bug ID 25446
Summary lldb Python extension module is linked to libpython
Product lldb
Version unspecified
Hardware PC
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter llvm@tim-smith.us
CC llvm-bugs@lists.llvm.org
Classification Unclassified

Hi; I'm a maintainer of Homebrew, a package manager for OS X. We package and
distribute LLVM. LLDB builds an import-able Python module which lands in
lib/python2.7/site-packages/lldb/_lldb.so. When LLVM and LLDB are built using
the cmake build (and possibly otherwise), this module is explicitly linked
against a Python framework, and it should not be, because that prevents the
module from being imported by a compatible interpreter located somewhere else
on the system. An attempt to do so will result in segfaults. This is
unnecessary and makes the module harder to distribute. The module should be
built with -undefined dynamic_lookup instead of -lpython.

Please see this blog post for more background:

Running otool -L against the module shows that it has an explicit link to a
Python framework:

tim@rocketman:~$ otool -L
(compatibility version 2.7.0, current version 2.7.10)

Extension modules should not show this linkage.

This Homebrew bug is related: [https://github.com/Homebrew/homebrew/pull/45787](https://github.com/Homebrew/homebrew/pull/45787)