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

platform_triplet.c uses possibly undefined TARGET_OS_* macros #117886

Closed
jmroot opened this issue Apr 15, 2024 · 3 comments · Fixed by #118073
Closed

platform_triplet.c uses possibly undefined TARGET_OS_* macros #117886

jmroot opened this issue Apr 15, 2024 · 3 comments · Fixed by #118073
Labels
build The build process and cross-build OS-mac type-bug An unexpected behavior, bug, or error

Comments

@jmroot
Copy link
Contributor

jmroot commented Apr 15, 2024

Bug report

Bug description:

The symptom is:

configure:6892: checking for the platform triplet based on compiler characteristics
configure:6900: result: none

which of course leads to all kinds of problems later in the build. The problem is that platform_triplet.c uses TARGET_OS_IOS, TARGET_OS_SIMULATOR and TARGET_OS_OSX without checking if they are defined. While this is valid according to the C standard with undefined macros evaluating to 0, it's a problem for two reasons: Older macOS SDKs don't define these, and the code assumes that TARGET_OS_OSX being false means it's not building for macOS, and secondly some clang versions will error if you use any macro starting with TARGET_OS_ without checking if it is defined.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

@jmroot jmroot added the type-bug An unexpected behavior, bug, or error label Apr 15, 2024
jmroot added a commit to jmroot/cpython that referenced this issue Apr 15, 2024
Older macOS SDKs don't define any of these, and some clang versions
will error if you use them without first checking if they are defined.
@erlend-aasland erlend-aasland added build The build process and cross-build OS-mac labels Apr 15, 2024
@ronaldoussoren
Copy link
Contributor

@jmroot, Out of interest: How old are the old SDKs you mention? And which clang versions are problematic?

@jmroot
Copy link
Contributor Author

jmroot commented Apr 15, 2024

We got a downstream report from a user on 10.11. AFAIK the very latest clang versions default to -Werror,-Wundef-prefix=TARGET_OS_ and it started doing that in version 11 or earlier.

@ned-deily
Copy link
Member

Thanks again for the issue. As discussed in the associated PR #117887, the suggested change has been rolled up and merged in PR #118073.

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

Successfully merging a pull request may close this issue.

4 participants