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

setup.py not picking up tkinter headers from non-system macOS Tcl and Tk frameworks #83343

Closed
tonybaloney mannequin opened this issue Dec 30, 2019 · 4 comments
Closed
Assignees
Labels
3.9 only security fixes build The build process and cross-build

Comments

@tonybaloney
Copy link
Mannequin

tonybaloney mannequin commented Dec 30, 2019

BPO 39162
Nosy @ned-deily, @tonybaloney
PRs
  • bpo-39162 fix a logic bug in the Tcl/Tk include scanner for macOS in setup.py #17753
  • Superseder
  • bpo-34956: _tkinter built on macOS 10.14 does not link to Tcl and Tk in /Library/Frameworks
  • 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 2020-05-18.13:59:47.036>
    created_at = <Date 2019-12-30.08:35:06.559>
    labels = ['build', '3.9']
    title = 'setup.py not picking up tkinter headers from non-system macOS Tcl and Tk frameworks'
    updated_at = <Date 2020-05-18.13:59:47.035>
    user = 'https://github.com/tonybaloney'

    bugs.python.org fields:

    activity = <Date 2020-05-18.13:59:47.035>
    actor = 'ned.deily'
    assignee = 'ned.deily'
    closed = True
    closed_date = <Date 2020-05-18.13:59:47.036>
    closer = 'ned.deily'
    components = ['Build']
    creation = <Date 2019-12-30.08:35:06.559>
    creator = 'anthonypjshaw'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39162
    keywords = ['patch']
    message_count = 4.0
    messages = ['359026', '359027', '359034', '369222']
    nosy_count = 2.0
    nosy_names = ['ned.deily', 'anthonypjshaw']
    pr_nums = ['17753']
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '34956'
    type = 'compile error'
    url = 'https://bugs.python.org/issue39162'
    versions = ['Python 3.9']

    @tonybaloney
    Copy link
    Mannequin Author

    tonybaloney mannequin commented Dec 30, 2019

    ./configure && make -j4 is returning:

    Failed to build these modules:
    _tkinter

    I'm running macOS 10.15.2, with the SDK installed using xcode-select --install (no funny business)

    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/

    xcrun --show-sdk-path
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

    If I debug setup.py, I can see it's eagerly returning the wrong path (/System)

    On a REPL, if I do:
    >>> import setup
    >>> setup.macosx_sdk_root()
    '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'

    So the path is correct, but I can see in setup.py that detect_tkinter_darwin() will break inside the loop if /System/Library/Frameworks/Tk.framework/Versions/Current exists (which it does), but it doesn't contain the headers, it contains 3 directories:

    Resources Tk _CodeSignature

    I think detect_tkinter_darwin should be updated so that framework_dirs scans macosx_sdk_root first, but I don't know what other scenarios this might break.

    I'd be happy to submit a patch for my scenario but it looks like this whole function needs tests so each platform change and scenario as they come up. There's loads of other issues on BPO related.

    @tonybaloney tonybaloney mannequin added build The build process and cross-build labels Dec 30, 2019
    @tonybaloney
    Copy link
    Mannequin Author

    tonybaloney mannequin commented Dec 30, 2019

    I also can't see how this condition would ever match, since macosx_sdk_root() is not in the list being iterated upon,
    https://github.com/python/cpython/blob/master/setup.py#L1774

    @tonybaloney
    Copy link
    Mannequin Author

    tonybaloney mannequin commented Dec 30, 2019

    This comes down to a logic bug in detect_tkinter_darwin(), shown in https://github.com/python/cpython/pull/17753/files#r361956102

    @ned-deily
    Copy link
    Member

    Thanks for the report and the PR. Yes, detect_tkinter_darwin() had a number of problems due mainly to how Apple has first deprecated and more recently removed the option to have header files installed in the running system. Plus some nasty quirks of how the Tcl and Tk frameworks are built make it difficult to use them without hacks for embedding while supporting Python build options. Your analysis was helpful. In the end, I tried to fix this and some more general problems in detect_tkinter_darwin() with PR 20171 for bpo-34956 which will be available in 3.9.0b1.

    @ned-deily ned-deily added the 3.9 only security fixes label May 18, 2020
    @ned-deily ned-deily changed the title setup.py not picking up tkinter headers setup.py not picking up tkinter headers from non-system macOS Tcl and Tk frameworks May 18, 2020
    @ned-deily ned-deily added the 3.9 only security fixes label May 18, 2020
    @ned-deily ned-deily changed the title setup.py not picking up tkinter headers setup.py not picking up tkinter headers from non-system macOS Tcl and Tk frameworks May 18, 2020
    @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
    3.9 only security fixes build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant