classification
Title: cpython tip fails to build on Mac OS X 10.11.6 w/ XCode 8.0
Type: compile error Stage: resolved
Components: Build Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: lazka, ned.deily, skip.montanaro
Priority: normal Keywords:

Created on 2016-10-02 22:59 by skip.montanaro, last changed 2016-10-24 18:57 by ned.deily. This issue is now closed.

Messages (8)
msg277914 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2016-10-02 22:59
Just trying an infrequent update of tip (last time seems to have been early July), I get a link error on my Mac:

% make
./Programs/_freeze_importlib \
	    ./Lib/importlib/_bootstrap.py Python/importlib.h
dyld: lazy symbol binding failed: Symbol not found: _getentropy
  Referenced from: /Users/skip/src/hgpython/cpython/./Programs/_freeze_importlib
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _getentropy
  Referenced from: /Users/skip/src/hgpython/cpython/./Programs/_freeze_importlib
  Expected in: /usr/lib/libSystem.B.dylib

make: *** [Python/importlib.h] Trace/BPT trap: 5

I'm running Mac OS X 10.11.6, and upgraded to XCode 8.0 a few days ago. Searching for the error, I saw some suggestions elsewhere on the web that this might be a known problem, though I saw nothing here (just searched for _getentropy).
msg277924 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-10-03 02:46
There are various reports about Xcode 8.0 providing a 10.12 SDK which will include refs to symbols not available yet on 10.11.  Try installing the command line tools via:

$ xcode-select --install

and doing a "make distclean" and then a complete configure and rebuild.
msg277949 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2016-10-03 10:15
Thanks, Ned. Unintuitive though it may be, that seems to have done the trick.
msg278082 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-10-04 19:15
It is a bit confusing but, in general these days, you should always install the current command line tools specific to the version of the Mac operating system you are running.  That ensures that not only are the necessary build tools installed but also that the correct system header files are installed in /usr/include and elsewhere.  To build cpython it is not necessary to download and install the full Xcode package, only the command line tools.  As you discovered, by not installing the clt, the build falls back to using the headers from an Xcode-supplied SDK which may be for a newer system than the one you are building on and thus might require dealing with missing OS features.
msg279299 - (view) Author: Christoph Reiter (lazka) * Date: 2016-10-24 09:06
I get the same error when building python on osx 10.12 + xcode 8 for 10.9+ and then running it on 10.11.

Any idea what could be the problem?
msg279325 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-10-24 18:36
Christoph, building on a newer OS X release for an older OS X release is tricky and out-of-scope for this closed issue.  (But, it likely has the same root cause.  The simplest solution is to build on the lowest-supported release, e.g. 10.9.  You may also have success building on 10.12 by setting MACOSX_DEPLOYMENT_TARGET=10.9 and, if necessary, using the 10.9 SDK.)
msg279327 - (view) Author: Christoph Reiter (lazka) * Date: 2016-10-24 18:40
Thanks for your response. I'm using MACOSX_DEPLOYMENT_TARGET etc. and it has worked so far building on 10.9/10/11 for running on 10.6.

If I find a cause/fix I'll open a new issue.
msg279329 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-10-24 18:57
There clearly was a specific problem introduced with the 10.12 SDK.  It may be possible to work around by adding AVAILABILITY macros at appropriate spots in C code or some such.  If someone is interested in supplying a patch, I'm willing to consider applying it but we don't claim to support downward-compatible building for reasons like this.
History
Date User Action Args
2016-10-24 18:57:23ned.deilysetmessages: + msg279329
2016-10-24 18:40:14lazkasetmessages: + msg279327
2016-10-24 18:36:09ned.deilysetmessages: + msg279325
2016-10-24 09:06:09lazkasetnosy: + lazka
messages: + msg279299
2016-10-04 19:15:28ned.deilysetstatus: open -> closed
resolution: not a bug
messages: + msg278082

stage: resolved
2016-10-03 10:15:34skip.montanarosetmessages: + msg277949
2016-10-03 02:46:21ned.deilysetnosy: + ned.deily
messages: + msg277924
2016-10-02 23:01:53skip.montanarosettitle: cpython tip fails to build on Mac OS X -> cpython tip fails to build on Mac OS X 10.11.6 w/ XCode 8.0
2016-10-02 22:59:33skip.montanarocreate