Skip to content

compiler detection on macOS seems to be incorrect #88259

Closed as not planned
Closed as not planned

Description

@xrisk
mannequin
BPO 44093
Nosy @ronaldoussoren, @ned-deily, @xrisk
PRs
  • bpo-43109: Fix --with-lto configure option on macOS #26341
  • 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 = 'https://github.com/ned-deily'
    closed_at = None
    created_at = <Date 2021-05-10.03:01:36.707>
    labels = ['3.7', '3.8', '3.9', 'build', 'OS-mac', 'type-bug', '3.10', '3.11']
    title = 'compiler detection on macOS seems to be incorrect'
    updated_at = <Date 2021-05-25.02:05:34.966>
    user = 'https://github.com/xrisk'

    bugs.python.org fields:

    activity = <Date 2021-05-25.02:05:34.966>
    actor = 'ned.deily'
    assignee = 'ned.deily'
    closed = False
    closed_date = None
    closer = None
    components = ['Build', 'macOS']
    creation = <Date 2021-05-10.03:01:36.707>
    creator = 'xrisk'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44093
    keywords = ['patch']
    message_count = 1.0
    messages = ['393346']
    nosy_count = 3.0
    nosy_names = ['ronaldoussoren', 'ned.deily', 'xrisk']
    pr_nums = ['26341']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44093'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. xrisk commented on May 10, 2021

      xriskmannequin
      MannequinAuthor

      On macOS devices, the configure script seems to always detect gcc, even though Apple does not ship with gcc — the gcc binary is simply a wrapper around clang (probably llvm-gcc?)

      I believe the issue is with these lines.

      cpython/configure.ac

      Lines 630 to 635 in 8e8307d

      if test -n "`"$found_gcc" --version | grep llvm-gcc`"
      then
      AC_MSG_NOTICE([Detected llvm-gcc, falling back to clang])
      CC="$found_clang"
      CXX="$found_clang++"
      fi

      Concretely, gcc —-version produces this on my computer:

      $ gcc --version
      Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
      Apple clang version 12.0.5 (clang-1205.0.22.9)
      Target: x86_64-apple-darwin20.4.0
      Thread model: posix
      InstalledDir: /Library/Developer/CommandLineTools/usr/bin

      Perhaps an additional check for “clang” would solve the issue.

    2. added
      3.11only security fixes
      buildThe build process and cross-build
      type-bugAn unexpected behavior, bug, or error
      on May 10, 2021
    3. self-assigned this
      on May 10, 2021
    4. self-assigned this
      on May 10, 2021
    5. transferred this issue fromon Apr 10, 2022
    6. furkanonder commented on May 9, 2023

      @furkanonder
      Contributor

      @ned-deily The issue seems to be solved. We can close the issue.

    7. ned-deily commented on May 9, 2023

      @ned-deily
      Member

      The issue seems to be solved. We can close the issue.

      Perhaps I don't understand the desired result but it doesn't look solved to me. In particular, the test:

      if test -n "`"$found_gcc" --version | grep llvm-gcc`" 
      

      fails because compilers provided by current versions of Apple's Xcode or Command Line Tools no longer include the string llvm-gcc in their reported versions:

      $ gcc --version
      Apple clang version 14.0.3 (clang-1403.0.22.14.1)
      Target: x86_64-apple-darwin22.4.0
      Thread model: posix
      InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
      
      
    8. erlend-aasland commented on Apr 12, 2024

      @erlend-aasland
      Contributor

      Superseded by #110577.

      Let's continue the discussion over there.

      See also:

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.10 (EOL)end of life3.11only security fixes3.7 (EOL)end of life3.8 (EOL)end of life3.9 (EOL)end of lifeOS-macbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions