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

unavailable --with-universal-archs= macOS confgure options fail cryptically #82624

Closed
ned-deily opened this issue Oct 11, 2019 · 7 comments
Closed
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes build The build process and cross-build OS-mac

Comments

@ned-deily
Copy link
Member

BPO 38443
Nosy @ronaldoussoren, @ned-deily, @miss-islington
PRs
  • bpo-38443: Check that the specified universal architectures work #22910
  • [3.9] bpo-38443: Check that the specified universal architectures work (GH-22910) #23451
  • [3.8] bpo-38443: Check that the specified universal architectures work (GH-22910) #23452
  • 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 = None
    closed_at = <Date 2020-11-22.01:56:16.163>
    created_at = <Date 2019-10-11.07:53:54.821>
    labels = ['OS-mac', 'build', '3.8', '3.9', '3.10']
    title = 'unavailable --with-universal-archs= macOS confgure options fail cryptically'
    updated_at = <Date 2020-11-22.01:56:16.160>
    user = 'https://github.com/ned-deily'

    bugs.python.org fields:

    activity = <Date 2020-11-22.01:56:16.160>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-11-22.01:56:16.163>
    closer = 'ned.deily'
    components = ['Build', 'macOS']
    creation = <Date 2019-10-11.07:53:54.821>
    creator = 'ned.deily'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38443
    keywords = ['patch']
    message_count = 7.0
    messages = ['354429', '354430', '379346', '379411', '381580', '381581', '381582']
    nosy_count = 3.0
    nosy_names = ['ronaldoussoren', 'ned.deily', 'miss-islington']
    pr_nums = ['22910', '23451', '23452']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue38443'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @ned-deily
    Copy link
    Member Author

    ./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.

    @ned-deily ned-deily added 3.8 only security fixes 3.9 only security fixes build The build process and cross-build OS-mac labels Oct 11, 2019
    @ned-deily
    Copy link
    Member Author

    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

    @ronaldoussoren
    Copy link
    Contributor

    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.

    @ronaldoussoren
    Copy link
    Contributor

    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).

    @miss-islington
    Copy link
    Contributor

    New changeset 0f20bd9 by Ronald Oussoren in branch 'master':
    bpo-38443: Check that the specified universal architectures work (GH-22910)
    0f20bd9

    @miss-islington
    Copy link
    Contributor

    New changeset 748d38b by Miss Islington (bot) in branch '3.9':
    [3.9] bpo-38443: Check that the specified universal architectures work (GH-22910) (GH-23451)
    748d38b

    @miss-islington
    Copy link
    Contributor

    New changeset 6e66542 by Miss Islington (bot) in branch '3.8':
    bpo-38443: Check that the specified universal architectures work (GH-22910)
    6e66542

    @ned-deily ned-deily added the 3.10 only security fixes label Nov 22, 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.8 only security fixes 3.9 only security fixes 3.10 only security fixes build The build process and cross-build OS-mac
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants