<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - lldb Python extension module is linked to libpython"
   href="https://llvm.org/bugs/show_bug.cgi?id=25446">25446</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb Python extension module is linked to libpython
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </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>llvm@tim-smith.us
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:
<a href="http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/">http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/</a>

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

tim@rocketman:~$ otool -L
/usr/local/Cellar/llvm/3.6.2/lib/python2.7/site-packages/lldb/_lldb.so
/usr/local/Cellar/llvm/3.6.2/lib/python2.7/site-packages/lldb/_lldb.so:
        ...
    /System/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.10)

Extension modules should not show this linkage.

This Homebrew bug is related: <a href="https://github.com/Homebrew/homebrew/pull/45787">https://github.com/Homebrew/homebrew/pull/45787</a></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>