classification
Title: 2.7 32-bit builds fail on macOS 10.12 Sierra due to dependency on deleted header file QuickTime/QuickTime.h
Type: compile error Stage: resolved
Components: Build, macOS Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: Lapsang Leaf, belopolsky, jeremyhu, ned.deily, python-dev, ronaldoussoren, sashk, tdsmith
Priority: normal Keywords: patch

Created on 2016-08-19 21:58 by ned.deily, last changed 2016-10-17 16:52 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
issue27806.patch sashk, 2016-09-12 18:55
issue27806_v2.patch sashk, 2016-09-16 13:57
issue27806_v3.patch sashk, 2016-09-17 00:04
smime.p7s jeremyhu, 2016-10-17 16:04
Messages (18)
msg273159 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-08-19 21:58
Attempts to build Python 2.7 using OS X/macOS public beta versions of the latest command-line tools can fail due to the removal of the system header file for QuickTime/QuickTime.h, one of the long deprecated Carbon APIs.  Currently, Python only attempts to build modules dependent on this file when building for 32-bit archs so this problem typically only affects builds with --with-universal-archs= configure options like "intel" or "intel-32".  It would be nice to preserve the ability to make use of QuickTime on older systems where the header file is still available.  Since the old Python mac modules don't exist in Python 3.x, this is only a 2.7 issue.
msg276088 - (view) Author: sashk (sashk) * Date: 2016-09-12 18:55
I've made attempt to make Python 2.7 compile 32-bit version on macOS 10.12 Sierra. See attached patch. With this patch, I was able to compile universal (32-bit/64-bit) python binary on macOS 10.12 GM.
msg276613 - (view) Author: Jeremy Sequoia (jeremyhu) Date: 2016-09-15 20:24
AvailabilityMacros.h is super deprecated and should not be used by anything current. Availability.h was added as replacement in 10.5.

__MAC_OS_X_VERSION_MAX_ALLOWED should be checked instead of defined (DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER)

You should really have a central config and use that instead. Eg:

#include <Availability.h>
#define APPLE_SUPPORTS_QUICKTIME (__MAC_OS_X_VERSION_MAX_ALLOWED < 101200) || !__LP64__

Then use APPLE_SUPPORTS_QUICKTIME throughout.  That avoids tons of churn whenever things change (as exemplified by this very bug)
msg276636 - (view) Author: Jeremy Sequoia (jeremyhu) Date: 2016-09-15 23:04
Correction (bugfix and Tiger-compat):

#if __has_include(<Availability.h>)
#include <Availability.h>
#define APPLE_SUPPORTS_QUICKTIME (__MAC_OS_X_VERSION_MAX_ALLOWED < 101200) && !__LP64__
#else
#define APPLE_SUPPORTS_QUICKTIME !__LP64__
#endif
msg276637 - (view) Author: sashk (sashk) * Date: 2016-09-15 23:11
> You should really have a central config

I planned to, but didn't find any existing place to put it into. Any suggestions?  

I'll provide updated version of the patch sometime tomorrow.
msg276638 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2016-09-15 23:27
> didn't find any existing place to put it into. Any suggestions?

I would put it in Include/pymacconfig.h.
msg276713 - (view) Author: sashk (sashk) * Date: 2016-09-16 13:57
Thank you for feedback. Here is second version of the patch.
msg276738 - (view) Author: Jeremy Sequoia (jeremyhu) Date: 2016-09-16 19:06
Thanks, yep that looks much nicer to me.  Containing the core logic at a central choke point makes maintenance much easier.  I'll work to get this into MacPorts.
msg276752 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-09-16 21:29
sashk, thanks for the patches!  The general approach LGTM as well.  Unfortunately, we need the fix to work with gcc-4.2 since the Python 2.7 installers are still built and supported on OS X 10.5 and 10.6 and the __has_include preprocessor construct is not available in gcc-4.2.
msg276753 - (view) Author: Jeremy Sequoia (jeremyhu) Date: 2016-09-16 21:35
sys/cdefs.h (on new enough darwin) does this for such cases:

#ifndef __has_include
#define __has_include(x) 0
#endif

but of course that isn't present in sys/cdefs.h on older SDKs, so you can just shove that above the check and it should fallback the way you want.

Using gcc-4.2 on Sierra would end up with the wrong result, but that's not a supported configuration.
msg276759 - (view) Author: sashk (sashk) * Date: 2016-09-17 00:04
Ned, please see attached third version of the patch with workaround suggested by Jeremy for older versions of OS X.
msg276767 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-17 03:13
New changeset 4030300fcb18 by sashk in branch '2.7':
Issue #27806: Fix 32-bit builds on macOS Sierra 10.12 broken by removal of
https://hg.python.org/cpython/rev/4030300fcb18
msg276769 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-09-17 03:18
Thanks, Alexander and especially Jeremy, for the reviews and suggestions.  Thanks again sashk for the patches.  Committed for release in 2.7.13.
msg276905 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-18 19:24
New changeset a8771f230c06 by Ned Deily in branch '2.7':
Issue #27806: add Aleks to Misc/ACKS.
https://hg.python.org/cpython/rev/a8771f230c06
msg278803 - (view) Author: Lapsang Leaf (Lapsang Leaf) Date: 2016-10-17 12:23
Can we have this in English, please, for noobs?

I only use python in order to run zim on my mac. I do not have the same technical know-how as many users and I do not understand the parlance here.  Currently I have OS X 10.12 with python 2.7 - updating to sierra seems to have broken it.

Please let me know, step by step, what I need to do to patch and get it running again.  Thanks
msg278811 - (view) Author: Jeremy Sequoia (jeremyhu) Date: 2016-10-17 16:04
QuickTime/QuickTime.h was deprecated long ago.

python fails to compile if QuickTime/QuickTime.h isn't present.

QuickTime/QuickTime.h was removed in Sierra, causing the build to fail on Sierra.

This patch fixes that issue.

> On Oct 17, 2016, at 05:23, Lapsang Leaf <report@bugs.python.org> wrote:
> 
> 
> Lapsang Leaf added the comment:
> 
> Can we have this in English, please, for noobs?
> 
> I only use python in order to run zim on my mac. I do not have the same technical know-how as many users and I do not understand the parlance here.  Currently I have OS X 10.12 with python 2.7 - updating to sierra seems to have broken it.
> 
> Please let me know, step by step, what I need to do to patch and get it running again.  Thanks
> 
> ----------
> nosy: +Lapsang Leaf
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue27806>
> _______________________________________
msg278812 - (view) Author: Lapsang Leaf (Lapsang Leaf) Date: 2016-10-17 16:05
Yes, I understood that part, sorry.  What I don’t understand is how to work/install the patch you have provided?
So, again, please let me know, step by step, what I need to do to patch and get it running.  Thanks

> On 17 Oct 2016, at 17:04, Jeremy Sequoia <report@bugs.python.org> wrote:
> 
> 
> Jeremy Sequoia added the comment:
> 
> QuickTime/QuickTime.h was deprecated long ago.
> 
> python fails to compile if QuickTime/QuickTime.h isn't present.
> 
> QuickTime/QuickTime.h was removed in Sierra, causing the build to fail on Sierra.
> 
> This patch fixes that issue.
> 
>> On Oct 17, 2016, at 05:23, Lapsang Leaf <report@bugs.python.org> wrote:
>> 
>> 
>> Lapsang Leaf added the comment:
>> 
>> Can we have this in English, please, for noobs?
>> 
>> I only use python in order to run zim on my mac. I do not have the same technical know-how as many users and I do not understand the parlance here.  Currently I have OS X 10.12 with python 2.7 - updating to sierra seems to have broken it.
>> 
>> Please let me know, step by step, what I need to do to patch and get it running again.  Thanks
>> 
>> ----------
>> nosy: +Lapsang Leaf
>> 
>> _______________________________________
>> Python tracker <report@bugs.python.org>
>> <http://bugs.python.org/issue27806>
>> _______________________________________
> 
> ----------
> Added file: http://bugs.python.org/file45123/smime.p7s
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue27806>
> _______________________________________<smime.p7s>
msg278818 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-10-17 16:52
Lapsang, sorry but this bug tracker is not a help forum.  There are many other, more appropriate places to ask for help in building software, like Stack Overflow or the Python mailing list.  But, if you are not comfortable patching and building software from source, you should consider using a third-party package manager like MacPorts or Homebrew to install zim and all of its dependencies, like Python.
History
Date User Action Args
2016-10-17 16:52:51ned.deilysetmessages: + msg278818
2016-10-17 16:05:53Lapsang Leafsetmessages: + msg278812
2016-10-17 16:04:11jeremyhusetfiles: + smime.p7s

messages: + msg278811
2016-10-17 12:23:33Lapsang Leafsetnosy: + Lapsang Leaf
messages: + msg278803
2016-09-18 19:24:58python-devsetmessages: + msg276905
2016-09-17 03:18:15ned.deilysetstatus: open -> closed
title: 2.7 32-bit builds fail on future releases of OS X due to dependency on deleted header file -> 2.7 32-bit builds fail on macOS 10.12 Sierra due to dependency on deleted header file QuickTime/QuickTime.h
messages: + msg276769

resolution: fixed
stage: needs patch -> resolved
2016-09-17 03:13:42python-devsetnosy: + python-dev
messages: + msg276767
2016-09-17 00:04:22sashksetfiles: + issue27806_v3.patch

messages: + msg276759
2016-09-16 21:35:25jeremyhusetmessages: + msg276753
2016-09-16 21:29:50ned.deilysetmessages: + msg276752
2016-09-16 19:06:51jeremyhusetmessages: + msg276738
2016-09-16 13:57:49sashksetfiles: + issue27806_v2.patch

messages: + msg276713
2016-09-15 23:27:40belopolskysetmessages: + msg276638
2016-09-15 23:11:25sashksetmessages: + msg276637
2016-09-15 23:04:36jeremyhusetmessages: + msg276636
2016-09-15 20:34:10ppperrysettype: compile error
2016-09-15 20:24:33jeremyhusetnosy: + jeremyhu
messages: + msg276613
2016-09-15 06:25:20tdsmithsetnosy: + tdsmith
2016-09-12 18:55:25sashksetfiles: + issue27806.patch
keywords: + patch
messages: + msg276088
2016-09-12 16:43:15belopolskysetnosy: + belopolsky
2016-09-12 13:52:14sashksetnosy: + sashk
2016-08-19 21:58:19ned.deilycreate