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

Python doesn't find Xcode 7 SDK stub libraries #69323

Closed
tdsmith mannequin opened this issue Sep 16, 2015 · 6 comments
Closed

Python doesn't find Xcode 7 SDK stub libraries #69323

tdsmith mannequin opened this issue Sep 16, 2015 · 6 comments
Assignees
Labels
build The build process and cross-build OS-mac stdlib Python modules in the Lib dir

Comments

@tdsmith
Copy link
Mannequin

tdsmith mannequin commented Sep 16, 2015

BPO 25136
Nosy @brettcannon, @ronaldoussoren, @ned-deily, @merwok, @dstufft, @tdsmith
Files
  • xcode-stubs.diff: Diff against 3.5.0 release
  • xcode-stubs-2.7.patch: Patch against 2.7 release branch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ned-deily'
    closed_at = <Date 2016-02-24.14:44:52.495>
    created_at = <Date 2015-09-16.01:03:02.962>
    labels = ['OS-mac', 'build', 'library']
    title = "Python doesn't find Xcode 7 SDK stub libraries"
    updated_at = <Date 2016-02-24.14:44:52.493>
    user = 'https://github.com/tdsmith'

    bugs.python.org fields:

    activity = <Date 2016-02-24.14:44:52.493>
    actor = 'ned.deily'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2016-02-24.14:44:52.495>
    closer = 'ned.deily'
    components = ['Build', 'Distutils', 'macOS']
    creation = <Date 2015-09-16.01:03:02.962>
    creator = 'tdsmith'
    dependencies = []
    files = ['40478', '40479']
    hgrepos = []
    issue_num = 25136
    keywords = ['patch']
    message_count = 6.0
    messages = ['250813', '250894', '260694', '260803', '260804', '260805']
    nosy_count = 8.0
    nosy_names = ['brett.cannon', 'ronaldoussoren', 'ned.deily', 'eric.araujo', 'afoglia', 'python-dev', 'dstufft', 'tdsmith']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue25136'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    @tdsmith
    Copy link
    Mannequin Author

    tdsmith mannequin commented Sep 16, 2015

    In Xcode 7, Apple is replacing many of the .dylibs in SDKROOT with textual stubs. 1 These files exist on disk with filenames like:

    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libz.tbd

    They are short YAML documents that look like this: 2

    The same linker invocation that has always worked will continue to work with Xcode 7 (i.e. you still pass -lz to the linker), but this disrupts the checks that cpython's setup.py uses to determine if it can build extension modules. The dylibs physically exist on disk in /usr/lib, but since we've set -isysroot to the appropriate SDKROOT in CPPFLAGS, distutils searches for the dylibs in the sysroot path, and does not find them (since they have been replaced with .tbd stubs). Since distutils cannot find the libraries, setup.py declines to attempt to build any of the extension modules that depend on libraries in the OS X SDK, even though it would have succeeded if it had tried. Several Homebrew users have reported this while trialling Xcode 7 3.

    distutils should treat the .tbd files as a "real" library so that compiler.find_library_file succeeds and setup.py will proceed to attempt to build the extension modules.

    The attached diff applies against the 3.5.0 release and allows extension modules to be built against Xcode 7 without installing the Command-Line Tools package.

    If anyone is experiencing this issue, a workaround is to install the Xcode Command Line Tools package with xcode-select --install (which, among other things, installs headers to /usr/include), ensure the CLT is active with xcode-select -s /Library/Developer/CommandLineTools, and do not include -isysroot in CPPFLAGS when building python.

    @tdsmith tdsmith mannequin added build The build process and cross-build stdlib Python modules in the Lib dir OS-mac labels Sep 16, 2015
    @ned-deily
    Copy link
    Member

    Thanks for the analysis and the patches, Tim. Now that Xcode 7 is released, we'll need to ensure we fully support the new stubs. But, as you note, the workaround as always is to make sure that the current Command Line Tools are installed, the configuration that we test with.

    @ned-deily ned-deily self-assigned this Sep 17, 2015
    @brettcannon
    Copy link
    Member

    We should update the devguide to specify that the command-line tools need to be installed and either explain or point to documentation on how to install the tools.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 24, 2016

    New changeset 59d797915dca by Ned Deily in branch '2.7':
    Issue bpo-25136: Support Apple Xcode 7's new textual SDK stub libraries.
    https://hg.python.org/cpython/rev/59d797915dca

    New changeset b0490b8af7aa by Ned Deily in branch '3.5':
    Issue bpo-25136: Support Apple Xcode 7's new textual SDK stub libraries.
    https://hg.python.org/cpython/rev/b0490b8af7aa

    New changeset db6c1308eb31 by Ned Deily in branch 'default':
    Issue bpo-25136: merge from 3.5
    https://hg.python.org/cpython/rev/db6c1308eb31

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 24, 2016

    New changeset 157eb9d40bf9 by Ned Deily in branch '2.7':
    Issue bpo-25136: Add reference to 'xcode-select --install' to Mac README.
    https://hg.python.org/cpython/rev/157eb9d40bf9

    New changeset 61752c7ea9c7 by Ned Deily in branch '3.5':
    Issue bpo-25136: Add reference to 'xcode-select --install' to Mac README.
    https://hg.python.org/cpython/rev/61752c7ea9c7

    New changeset 2c4448bbed1f by Ned Deily in branch 'default':
    Issue bpo-25136: merge from 3.5
    https://hg.python.org/cpython/rev/2c4448bbed1f

    @ned-deily
    Copy link
    Member

    I've committed Tim's patches with some additional comments for release in 2.7.12, 3.5,2, and 3.6.0 and have added a note about using 'xcode-select --install' to the Mac/README files. (The Developer's Guide already documents this.) Thanks again, Tim.

    @ned-deily ned-deily changed the title Python doesn't find Xcode 7 stub libraries Python doesn't find Xcode 7 SDK stub libraries Feb 24, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build OS-mac stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants