Homebrew / homebrew-core

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

qmake fails after Xcode tools update, "failed to parse default search paths from compiler output" #144051

Closed c3d closed 1 year ago

c3d commented 1 year ago

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

$ brew gist-logs qt
Error: No logs.

$ brew config 
HOMEBREW_VERSION: 4.1.12
ORIGIN: https://github.com/Homebrew/brew
HEAD: aa2a77b1f1ac1539e69e186bad1d569100448987
Last commit: 3 days ago
Core tap JSON: 19 Sep 15:57 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.POHQ6QaZR7/org.xquartz:0
HOMEBREW_EDITOR: emacsclient
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 13.5.2-arm64
CLT: 15.0.0.0.1.1694021235
Xcode: N/A
Rosetta 2: false

$ brew doctor
Your system is ready to brew.

Verification

What were you trying to do (and why)?

Building a project that uses qt and had been building for months. Moments after an XCode command-line tools update, the project started failing to build with an error:

Project ERROR: failed to parse default search paths from compiler output

This still happens after cleaning up the build directory and giving the spec manually, see below.

What happened (include all command output)?

$ qmake Project ERROR: failed to parse default search paths from compiler output

What did you expect to happen?

$ qmake (builds or update the makefile)

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

brew install qt
touch test.pro
qmake test.pro

clang --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
c3d commented 1 year ago

A little bit of additional debugging shows that we fail the test at /opt/homebrew/share/qt/mkspecs/features/toolchain.prf line 291, because QMAKE_DEFAULT_LIBDIRS is empty.

c3d commented 1 year ago

The output of the clang command seems to be:

Apple clang version 15.0.0 (clang-1500.0.40.1) Target: arm64-apple-darwin22.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin  "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple arm64-apple-macosx13.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -fno-strict-return -ffp-contract=on -fno-rounding-math -funwind-tables=1 -fobjc-msgsend-selector-stubs -target-sdk-version=14.0 -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +crc -target-feature +lse -target-feature +rdm -target-feature +crypto -target-feature +dotprod -target-feature +fp-armv8 -target-feature +neon -target-feature +fp16fml -target-feature +ras -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4 -target-feature +sha3 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -target-linker-version 1015.6 -v -fcoverage-compilation-dir=/opt/homebrew/Cellar/qt/6.5.1_3/share/qt/mkspecs/features -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -fdeprecated-macro -fdebug-compilation-dir=/opt/homebrew/Cellar/qt/6.5.1_3/share/qt/mkspecs/features -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -mllvm -disable-aligned-alloc-awareness=1 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/pg/78ks16517xb3w4cqkj7xlr4c0000gn/T/--cafbea.o -x c++ - clang -cc1 version 15.0.0 (clang-1500.0.40.1) default target arm64-apple-darwin22.6.0 ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include" ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks" #include "..." search starts here: #include <...> search starts here:  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1  /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include  /Library/Developer/CommandLineTools/usr/include  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory) End of search list.  "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate -dynamic -dylib -arch arm64 -platform_version macos 13.0.0 14.0 -single_module -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o /dev/null -v /var/folders/pg/78ks16517xb3w4cqkj7xlr4c0000gn/T/--cafbea.o -lc++ -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.osx.a ld: warning: -single_module is obsolete @(#)PROGRAM:ld  PROJECT:dyld-1015.7 BUILD 18:48:48 Aug 22 2023 configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29) TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3) Library search paths: Framework search paths:

I find the empty Library search paths a bit suspicious.

c3d commented 1 year ago

The command being run by toolchain.prf is the following, with its output:

 LC_ALL=C /Library/Developer/CommandLineTools/usr/bin/clang++ -pipe -stdlib=libc++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -g0 -single_module -dynamiclib -o /dev/null -v -Wl,-v -xc++ - 2>&1 </dev/null >/dev/null
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple arm64-apple-macosx13.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -fno-strict-return -ffp-contract=on -fno-rounding-math -funwind-tables=1 -fobjc-msgsend-selector-stubs -target-sdk-version=14.0 -fvisibility-inlines-hidden-static-local-var -target-cpu apple-m1 -target-feature +v8.5a -target-feature +crc -target-feature +lse -target-feature +rdm -target-feature +crypto -target-feature +dotprod -target-feature +fp-armv8 -target-feature +neon -target-feature +fp16fml -target-feature +ras -target-feature +rcpc -target-feature +zcm -target-feature +zcz -target-feature +fullfp16 -target-feature +sm4 -target-feature +sha3 -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=lldb -target-linker-version 1015.6 -v -fcoverage-compilation-dir=/Users/ddd/Work/calc/db48x/sim -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -fdeprecated-macro -fdebug-compilation-dir=/Users/ddd/Work/calc/db48x/sim -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -mllvm -disable-aligned-alloc-awareness=1 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/pg/78ks16517xb3w4cqkj7xlr4c0000gn/T/--56984d.o -x c++ -
clang -cc1 version 15.0.0 (clang-1500.0.40.1) default target arm64-apple-darwin22.6.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
 /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Library/Developer/CommandLineTools/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
 "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate -dynamic -dylib -arch arm64 -platform_version macos 13.0.0 14.0 -single_module -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o /dev/null -v /var/folders/pg/78ks16517xb3w4cqkj7xlr4c0000gn/T/--56984d.o -lc++ -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.osx.a
ld: warning: -single_module is obsolete
@(#)PROGRAM:ld  PROJECT:dyld-1015.7
BUILD 18:48:48 Aug 22 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3)
Library search paths:
Framework search paths:

Checking with another build on another machine.

Bo98 commented 1 year ago

https://bugreports.qt.io/browse/QTBUG-117225

It'll be fixed in Qt 6.5.3 scheduled for release in about a week.

We will likely need to carry a patch for qt@5 given 5.15 releases on a one year delay, and we potentially could carry an interim patch on Qt 6 too.

c3d commented 1 year ago

@Bo98 thanks!

c3d commented 1 year ago

@Bo98 I can confirm that applying the patch you listed fixes it.

c3d commented 1 year ago

@Bo98, is it OK if I close this? I find it useful for people to have an answer that is relatively easy to find, but I don't want to pollute the issues list with something where the fix is coming. Please reopen if you feel like I closed too early.

The fix given by @Bo98 is:

https://bugreports.qt.io/browse/QTBUG-117225

MRigal commented 1 year ago

@c3d and @Bo98 is someone working on a PR for that? I could else try myself, but I would need some indications in where/how to add the patch. Probably around https://github.com/Homebrew/homebrew-core/blob/3a6cb28f64107754c82496075192482739a0a4f6/Formula/q/qt@5.rb#L207 but I don't know if there is a policy if better before or after as it is only a problem at runtime.

And adding the patch here I guess: https://github.com/Homebrew/formula-patches/tree/master/qt5