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

failing configure command #95283

Closed
BizarreBits opened this issue Jul 26, 2022 · 10 comments
Closed

failing configure command #95283

BizarreBits opened this issue Jul 26, 2022 · 10 comments
Labels
build The build process and cross-build OS-mac type-bug An unexpected behavior, bug, or error

Comments

@BizarreBits
Copy link

BizarreBits commented Jul 26, 2022

Bug report

When trying to build Python from source code on Mac, the configure command fails.

config.log

Your environment

Python Version: 3.10.5
Operating System:

MacOS Monterey 12.3
64 Bit x68, Intel core CPU

Linked PRs

@BizarreBits BizarreBits added the type-bug An unexpected behavior, bug, or error label Jul 26, 2022
@erlend-aasland erlend-aasland added OS-mac build The build process and cross-build labels Jul 26, 2022
@erlend-aasland
Copy link
Contributor

From config.log:

clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=12.3'

@ned-deily
Copy link
Member

While you shouldn't have to by default, you can always override the deployment target as a workaround. Try appending it to your ./configure command:

./configure ... MACOSX_DEPLOYMENT_TARGET=12

@erlend-aasland
Copy link
Contributor

Hm, do we need to make adjustments for this in configure?

Also, I see we're passing on CONFIGURE_MACOSX_DEPLOYMENT_TARGET and EXPORT_MACOSX_DEPLOYMENT_TARGET to the makefile in Mac/ and Mac/PythonLauncher. Are they used? It seems to me they are not.

@ronaldoussoren
Copy link
Contributor

@BizarreBits : What's the output of xcodebuild -showsdks on your system? And which version of Xcode or the command-line tools is installed?

Also, does @ned-deily's suggestion of overriding the deployment target work for you? If you do have an older version of Xcode installed it may be necessary to specify an older deployment target as well. That's something I've never experimented with myself.

Our build system assumes that the compiler can target the current system version. That might be a problem if an old version of Xcode is installed on a newer version of macOS. I've check that using the current Xcode beta on macOS 12.3 is not a problem (as expected).

@erlend-aasland : I don't know if it is necessary to make adjustments to the configure script. If this is indeed an older Xcode version on a newer OS it might be possible to detect this and bail out, but I don't know if it is worthwhile to do this. It might be better to just document the assumption I mention earlier (but more clearly).

@ronaldoussoren
Copy link
Contributor

To answer my own question, config.log contains:

configure:3928: gcc --version >&5
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

According to https://gist.github.com/yamaya/2924292 this is the compiler shipped with Xcode 11 (and the corresponding command line tools), while the system runs macOS 12.3 (uname -r = 21.4.0 in config.log). Xcode 11 is Apple's "system" compiler for macOS 10.15.

The compiler on the system is too old to understand the new macOS numbering scheme introduced in macOS 11, which likely explain this error.

@BizarreBits : Why do you use an old version of Xcode to build on this system? In general it is better to use a newer compiler and explicitly target older macOS versions ("MACOSX_DEPLOYMENT_TARGET=10.15") when needed. CPython supports building on macOS 12.x while targeting older versions (the oldest deployment target that will work is macOS 10.9).

@ned-deily, @erlend-aasland: I propose closing this issue. Our support matrix is already fairly large when only supporting the latest compiler that Apple supports on the platform. Adding support for this variant will end up untested unless we (realistically, Ned) set up a VM with this configuration and include that in pre-release testing.

@erlend-aasland
Copy link
Contributor

I propose closing this issue. Our support matrix is already fairly large when only supporting the latest compiler that Apple supports on the platform.

+1

I don't know if it is necessary to make adjustments to the configure script. If this is indeed an older Xcode version on a newer OS it might be possible to detect this and bail out, but I don't know if it is worthwhile to do this. It might be better to just document the assumption I mention earlier (but more clearly).

I agree that is not worth it to make adjustments to configure. We could consider improving the documentation, though, before closing.

@ronaldoussoren
Copy link
Contributor

Documenting this is useful. We basically require the Xcode, or corresponding Command Line Tools, released with the OS, or a later one that's supported on the OS (generally the next major version).

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Aug 8, 2022

I'll see if I can find the time to produce a PR for Mac/README.txt. After a quick glance, it seems several sections in that file could make use of an update.

I'll ping you and Ned for review when I've got something.

@erlend-aasland erlend-aasland self-assigned this Aug 8, 2022
ronaldoussoren added a commit to ronaldoussoren/cpython that referenced this issue Nov 15, 2022
The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.
@ronaldoussoren
Copy link
Contributor

I've added a PR with some documentation about this. @ned-deily are notes like this something you prefer to back-port to 3.11 and 3.10?

Btw. Longer term it is probably better to merge most of Mac/README.txt into https://docs.python.org/3/using/index.html for increased visibility. But that's something for another day issue.

ronaldoussoren added a commit that referenced this issue Nov 23, 2022
The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 23, 2022
…99506)

The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.
(cherry picked from commit 8f024a0)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 23, 2022
…99506)

The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.
(cherry picked from commit 8f024a0)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
miss-islington added a commit that referenced this issue Nov 23, 2022
The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.
(cherry picked from commit 8f024a0)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
miss-islington added a commit that referenced this issue Nov 23, 2022
The build machinery assumes that the compiler that's used
to build on macOS includes an SDK that's at least as new
as the OS version on the build machine. Explicitly mention
this in Mac/README.txt.
(cherry picked from commit 8f024a0)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
@ronaldoussoren
Copy link
Contributor

The supported Xcode versions are now documented in Mac/README.txt, I'm closing the issue.

@erlend-aasland erlend-aasland removed their assignment Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build OS-mac type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants