Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.71k stars 12.41k forks source link

`gcc -pipe` fails to run #195299

Open nobu opened 6 hours ago

nobu commented 6 hours ago

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

brew config:

HOMEBREW_VERSION: 4.4.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 35ebf4a047b00b2b3de33ba0081d71293cdadede
Last commit: 2 days ago
Core tap JSON: 23 Oct 00:56 UTC
Core cask tap JSON: 23 Oct 00:56 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.Xgq05sFkgT/org.macports:0
HOMEBREW_EDITOR: emacsclient -n
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.3.5 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 16.0.0 build 1600
Git: 2.39.5 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 14.7-arm64
CLT: 16.0.0.0.1.1724870825
Xcode: 16.0
Rosetta 2: false

brew doctor:

Your system is ready to brew.

Verification

What were you trying to do (and why)?

Compile with -pipe option.

What happened (include all command output)?

Failed with "clang: error: no input files" message.

What did you expect to happen?

Compile as well as without -pipe option.

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

  1. Create a C program that should compile successfully.

    $ echo $'int main(void) {return 0;}' > conftest.c
  2. Compile it, and succeeds.

    $ gcc-14 -c conftest.c 
  3. Compile it with -pipe option.

    $ gcc-14 -c -pipe conftest.c 
    clang: error: no input files
  4. Other gcc-14, such as MacPorts, apt on Ubuntu etc, work with -pipe option.

    $ /opt/local/bin/gcc-mp-14 -c -pipe conftest.c
Bo98 commented 5 hours ago

This is an incompatibility with Xcode 16's as: https://github.com/iains/gcc-14-branch/commit/ea41179dab5df144d2ec137c94dcbe171e427728. A patch rollup release came last week and we're currently working on getting it updated (https://github.com/Homebrew/homebrew-core/pull/194797), hopefully by tomorrow.

nobu commented 5 hours ago

@Bo98 Thank you, I'm happy to hear it. Will it be applied to other versions, gcc@13 and earlier too?

$ set -x; for gcc in gcc-{11..14}; do $gcc -c conftest.c && $gcc -c -pipe conftest.c; done; set +x
+ for gcc in gcc-{11..14}
+ gcc-11 -c conftest.c
+ gcc-11 -c -pipe conftest.c
clang: error: no input files
+ for gcc in gcc-{11..14}
+ gcc-12 -c conftest.c
+ gcc-12 -c -pipe conftest.c
clang: error: no input files
+ for gcc in gcc-{11..14}
+ gcc-13 -c conftest.c
+ gcc-13 -c -pipe conftest.c
clang: error: no input files
+ for gcc in gcc-{11..14}
+ gcc-14 -c conftest.c
+ gcc-14 -c -pipe conftest.c
clang: error: no input files
+ set +x
Bo98 commented 5 hours ago

Backporting work for GCC 13 is ongoing: https://github.com/iains/gcc-13-branch/commits/gcc-13-3-darwin. I believe it's nearly ready and is being tested now so we should be applying those changes soon.

GCC 12 and earlier has other compatibility issues with Xcode 16 which requires different patches, so the timeframe of that is unclear at the moment. A temporary workaround could be to use macos-13, which will have Xcode 15.2 installed.

GCC 11 is technically EOL but we'll probably update it when patches are available since the macOS fork will continue development. GCC 10 and earlier are no longer supported by us on macOS 14 and later, regardless whether there's upstream patches or not.