|
| 1 | +qmake: Don't error out if QMAKE_DEFAULT_LIBDIRS is empty on macOS |
| 2 | + |
| 3 | +The new linker in Xcode 15 doesn't provide any default linker or |
| 4 | +framework paths when requested via -v, but still seems to use the |
| 5 | +default paths documented in the ld man page. |
| 6 | + |
| 7 | +We trust that linker will do the right thing, even if we don't |
| 8 | +know of its default linker paths. |
| 9 | + |
| 10 | +We also need to opt out of the default fallback logic to |
| 11 | +set the libdirs to /lib and /usr/lib. |
| 12 | + |
| 13 | +This may result in UnixMakefileGenerator::findLibraries finding |
| 14 | +different libraries than expected, if additional paths are |
| 15 | +passed with -L, which will then take precedence for qmake, |
| 16 | +even if the linker itself will use the library from the |
| 17 | +SDK's default paths. This should hopefully not be an issue |
| 18 | +in practice, as we don't turn -lFoo into absolute paths in |
| 19 | +qmake, so the only risk is that we're picking up the wrong |
| 20 | +prl files and adding additional dependencies that the lib |
| 21 | +in the SDK doesn't have. |
| 22 | + |
| 23 | +Upstream commits: |
| 24 | + - Qt 5.15.16: Not yet publicly available. |
| 25 | + - Qt dev: cdf64b0e47115cc473e1afd1472b4b09e130b2a5 |
| 26 | + |
| 27 | +For other Qt branches see |
| 28 | +https://codereview.qt-project.org/q/I2347b26e2df0828471373b0e15b8c9089274c65d |
| 29 | + |
| 30 | +--- old/qtbase/mkspecs/features/toolchain.prf |
| 31 | ++++ new/qtbase/mkspecs/features/toolchain.prf |
| 32 | +@@ -283,9 +283,12 @@ isEmpty($${target_prefix}.INCDIRS) { |
| 33 | + } |
| 34 | + } |
| 35 | + } |
| 36 | +- isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \ |
| 37 | ++ isEmpty(QMAKE_DEFAULT_INCDIRS): \ |
| 38 | + !integrity: \ |
| 39 | +- error("failed to parse default search paths from compiler output") |
| 40 | ++ error("failed to parse default include paths from compiler output") |
| 41 | ++ isEmpty(QMAKE_DEFAULT_LIBDIRS): \ |
| 42 | ++ !integrity:!darwin: \ |
| 43 | ++ error("failed to parse default library paths from compiler output") |
| 44 | + QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) |
| 45 | + } else: ghs { |
| 46 | + cmd = $$QMAKE_CXX $$QMAKE_CXXFLAGS -$${LITERAL_HASH} -o /tmp/fake_output /tmp/fake_input.cpp |
| 47 | +@@ -407,7 +410,7 @@ isEmpty($${target_prefix}.INCDIRS) { |
| 48 | + QMAKE_DEFAULT_INCDIRS = $$split(INCLUDE, $$QMAKE_DIRLIST_SEP) |
| 49 | + } |
| 50 | + |
| 51 | +- unix:if(!cross_compile|host_build) { |
| 52 | ++ unix:!darwin:if(!cross_compile|host_build) { |
| 53 | + isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include |
| 54 | + isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib |
| 55 | + } |
0 commit comments