Title: not picking up tkinter headers from non-system macOS Tcl and Tk frameworks
Type: compile error Stage: resolved
Components: Build Versions: Python 3.9
Status: closed Resolution: duplicate
Dependencies: Superseder: _tkinter built on macOS 10.14 does not link to Tcl and Tk in /Library/Frameworks
View: 34956
Assigned To: ned.deily Nosy List: anthonypjshaw, ned.deily
Priority: normal Keywords: patch

Created on 2019-12-30 08:35 by anthonypjshaw, last changed 2020-05-18 13:59 by ned.deily. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17753 closed anthonypjshaw, 2019-12-30 10:50
Messages (4)
msg359026 - (view) Author: anthony shaw (anthonypjshaw) * (Python triager) Date: 2019-12-30 08:35
./configure && make -j4 is returning:

Failed to build these modules:

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


xcrun --show-sdk-path

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

On a REPL, if I do:
>>> import setup
>>> setup.macosx_sdk_root()

So the path is correct, but I can see in 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.
msg359027 - (view) Author: anthony shaw (anthonypjshaw) * (Python triager) Date: 2019-12-30 08:39
I also can't see how this condition would ever match, since macosx_sdk_root() is not in the list being iterated upon,
msg359034 - (view) Author: anthony shaw (anthonypjshaw) * (Python triager) Date: 2019-12-30 10:53
This comes down to a logic bug in detect_tkinter_darwin(), shown in
msg369222 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-05-18 13:59
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 Issue34956 which will be available in 3.9.0b1.
Date User Action Args
2020-05-18 13:59:47ned.deilysetstatus: open -> closed

superseder: _tkinter built on macOS 10.14 does not link to Tcl and Tk in /Library/Frameworks
title: not picking up tkinter headers -> not picking up tkinter headers from non-system macOS Tcl and Tk frameworks
messages: + msg369222
versions: + Python 3.9
resolution: duplicate
stage: patch review -> resolved
2019-12-30 12:12:56ned.deilysetassignee: ned.deily
2019-12-30 10:53:22anthonypjshawsetmessages: + msg359034
2019-12-30 10:50:54anthonypjshawsetkeywords: + patch
stage: patch review
pull_requests: + pull_request17189
2019-12-30 08:39:04anthonypjshawsetmessages: + msg359027
2019-12-30 08:35:14anthonypjshawsetnosy: + ned.deily
2019-12-30 08:35:06anthonypjshawcreate