Skip to content

Recent GCC patches leave DEFAULT_CPU undefined in some cases #294935

Description

@h-vetinari

brew config AND brew doctor output OR brew gist-logs <formula> link

not applicable

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.
  • My issue is not about a failure to build a formula from source.

What were you trying to do (and why)?

The GCC patches (for v16 and recent patch releases) do the following

+/* Default architecture to use if -mcpu=native did not detect a known CPU. */
+#if TARGET_MACHO
+#define DEFAULT_ARCH "apple-m1"
+#else
+#define DEFAULT_ARCH "8A"
+#define DEFAULT_CPU "generic-armv8-a"
+#endif

i.e. define DEFAULT_CPU conditionally, while leaving codepaths elsewhere in that TU that require DEFAULT_CPU to be set unconditionally (or, more specifically, guarded by #if defined(__APPLE__), which is not equivalent to #if TARGET_MACHO).

This makes it impossible to build cross-compilers targetting darwin from linux, as we're doing (among other things) in conda-forge.

CC @fxcoudert for #287916

PS. Sorry for having to "lie" in the issue template; this is not directly a brew issue, but still belongs in this repo.

What happened (include all command output)?

GCC with homebrew patches applied should still compile under all circumstances.

What did you expect to happen?

GCC compiles successfully

Step-by-step reproduction instructions (by running brew commands)

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream issueAn upstream issue report is needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions