classification
Title: unavailable --with-universal-archs= macOS confgure options fail cryptically
Type: Stage: resolved
Components: Build, macOS Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, ned.deily, ronaldoussoren
Priority: normal Keywords: patch

Created on 2019-10-11 07:53 by ned.deily, last changed 2020-11-22 01:56 by ned.deily. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22910 merged ronaldoussoren, 2020-10-23 08:30
PR 23451 merged miss-islington, 2020-11-22 01:19
PR 23452 merged miss-islington, 2020-11-22 01:30
Messages (7)
msg354429 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-10-11 07:53
./configure's --with-universal-archs= supports a number of different CPU architecture combinations.  However most of them are no longer supported on current macOS systems.  If you choose an option with archs not available in the build tool chain in use, the configure script fails in various cryptic ways, usually with multiple configure test failures like:

checking dlfcn.h presence... yes
configure: WARNING: dlfcn.h: present but cannot be compiled
configure: WARNING: dlfcn.h:     check for missing prerequisite headers?
configure: WARNING: dlfcn.h: see the Autoconf documentation
configure: WARNING: dlfcn.h:     section "Present But Cannot Be Compiled"
configure: WARNING: dlfcn.h: proceeding with the compiler's result
configure: WARNING:     ## --------------------------------------- ##
configure: WARNING:     ## Report this to https://bugs.python.org/ ##
configure: WARNING:     ## --------------------------------------- ##

./configure should be more user-friendly here.  At a minimum, it should report near the beginning exactly which archs are going to be tested; it already reports the --with-universal-archs value.  Even better it should explicitly test for support of each arch in the build tool chain in use and stop if any of the requested archs are not available.
msg354430 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-10-11 08:08
Also note that, on current macOS systems, specifying just --enable-universalsdk to ./configure results in an implicit --with-universal-archs of intel (which implies both x86_64 and i386).

checking for --enable-universalsdk... /
checking for --with-universal-archs... intel

With macOS 10.15 Catalina and Xcode 11, i364 arch is no longer supported and that results in another cryptic ./configure failure:

checking size of size_t... configure: error: in `/Users/sysadmin/cpython':
configure: error: cannot compute sizeof (size_t)
See `config.log' for more details
msg379346 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-22 21:01
A fairly simple change is to check if compiling a file with the specified set of "-arch" flags works, and bail  out with a nice error message if it doesn't.

Something like this works:

diff --git a/configure.ac b/configure.ac
index f0bc8c6258..e26cdc8607 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1976,6 +1976,14 @@ yes)
         EXPORT_MACOSX_DEPLOYMENT_TARGET=''
         AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET)
 
+       AC_MSG_CHECKING(if specified build architectures work)
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+            [AC_MSG_RESULT(yes)],
+            [AC_MSG_RESULT(no)
+            AC_MSG_ERROR(check the '--with-universal-archs' option)
+        ])
+
+
         # end of Darwin* tests
         ;;
     esac


I'm not entirely happy with the phrasing, but at least you'll get a clearer message and one that indicate which configure argument can be used to fix it.
msg379411 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-23 08:31
I've added a PR with a variation of my earlier patch. This version will bail out when specifying "--enable-universalsdk" with a version of Xcode that does not support i386 (the previous patch did not).
msg381580 - (view) Author: miss-islington (miss-islington) Date: 2020-11-22 01:13
New changeset 0f20bd9042c9b7fce20c3b9511cd0820b30094c3 by Ronald Oussoren in branch 'master':
bpo-38443: Check that the specified universal architectures work (GH-22910)
https://github.com/python/cpython/commit/0f20bd9042c9b7fce20c3b9511cd0820b30094c3
msg381581 - (view) Author: miss-islington (miss-islington) Date: 2020-11-22 01:45
New changeset 748d38bf529d71d87cc7ef6d63e9df7d7d771ac9 by Miss Islington (bot) in branch '3.9':
[3.9] bpo-38443: Check that the specified universal architectures work (GH-22910) (GH-23451)
https://github.com/python/cpython/commit/748d38bf529d71d87cc7ef6d63e9df7d7d771ac9
msg381582 - (view) Author: miss-islington (miss-islington) Date: 2020-11-22 01:54
New changeset 6e665424d6e7abf6d6de010609a398a7407df83c by Miss Islington (bot) in branch '3.8':
bpo-38443: Check that the specified universal architectures work (GH-22910)
https://github.com/python/cpython/commit/6e665424d6e7abf6d6de010609a398a7407df83c
History
Date User Action Args
2020-11-22 01:56:16ned.deilysetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.10
2020-11-22 01:54:17miss-islingtonsetmessages: + msg381582
2020-11-22 01:45:28miss-islingtonsetmessages: + msg381581
2020-11-22 01:30:34miss-islingtonsetpull_requests: + pull_request22343
2020-11-22 01:19:43miss-islingtonsetpull_requests: + pull_request22342
2020-11-22 01:13:21miss-islingtonsetnosy: + miss-islington
messages: + msg381580
2020-10-23 08:31:52ronaldoussorensetmessages: + msg379411
2020-10-23 08:30:00ronaldoussorensetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request21841
2020-10-22 21:01:48ronaldoussorensetmessages: + msg379346
2019-10-11 08:08:33ned.deilysetmessages: + msg354430
2019-10-11 07:53:54ned.deilycreate