From 5772cac426d617ca1c6e27ab54b3c2e3f4cb046a Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 16 Jun 2017 15:10:16 +0300 Subject: qmake: Do not default to -pipe on Windows It is considered slightly faster than the default mode[1], but on Windows it causes trouble when aborting the build, it leaves behind zero-sized object files which cause link error. See discussion in the bug-make mailing list[2]. [1] https://stackoverflow.com/a/1512947/764870 [2] http://lists.gnu.org/archive/html/bug-make/2017-06/msg00066.html Change-Id: I7aa0b328a8c743fdfe9b0aece02b329066515076 Reviewed-by: Oswald Buddenhagen --- mkspecs/common/gcc-base.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mkspecs') diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf index e7e6ee1815..6a2fa4f506 100644 --- a/mkspecs/common/gcc-base.conf +++ b/mkspecs/common/gcc-base.conf @@ -36,7 +36,7 @@ QMAKE_CFLAGS_OPTIMIZE_FULL = -O3 QMAKE_CFLAGS_OPTIMIZE_DEBUG = -Og QMAKE_CFLAGS_OPTIMIZE_SIZE = -Os -QMAKE_CFLAGS += -pipe +!equals(QMAKE_HOST.os, Windows): QMAKE_CFLAGS += -pipe QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w -- cgit v1.2.3 From 353fb118c3d92bac2bfdd88922320d0d3e8563c2 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 4 Jul 2017 00:56:38 +0200 Subject: Fix detection of QMAKE_DEFAULT_LIBDIRS with Clang under Linux With 4183475080d334d7d17d02e6ad4eb53c01205c54, Qt fails to build if qmake is unable to detect the compiler's default include and library search paths. Clang on non-Darwin systems was missing working code for the detection. Unlike GCC, Clang on its own does not print the library search paths when called with the -v option. On Darwin, the -Wl,-v option will reach ld64, which will print those paths. However, neither GNU ld nor gold will print anything useful with just -v. GNU ld has a --verbose option that does print some search paths, but those are not the ones used when ld is invoked (via collect2) by GCC or Clang, so it can't be used. To make Clang print its library search paths one can use -print-search-dirs, which however doesn't print include search paths. So amend the existing code in order to make a second call to clang on non-Darwin systems. This second call is used for library path detection, and fixes the build on non-Darwin (tested on Linux). Change-Id: Ic858f908ee1a2e0eb307abb074daee0ded38abd5 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/toolchain.prf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mkspecs') diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index eb7b1385f2..b3726a1160 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -111,6 +111,26 @@ isEmpty($${target_prefix}.INCDIRS) { } } } + !darwin:clang { + # Clang on a non-Apple system (that is, a system without ld64 -- say, with GNU ld + # or gold under Linux) will not print any library search path. Need to use another + # invocation with different options (which in turn doesn't print include search + # paths, so it can't just be used in place of the above code). + # What's more, -print-search-dirs can't be used on clang on Apple because it + # won't print all the library paths (only the clang-internal ones). + output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec) + !equals(ec, 0): \ + error("Cannot run compiler '$$QMAKE_CXX'. Maybe you forgot to setup the environment?") + + for (line, output) { + contains(line, "^libraries: .*") { + line ~= s,^libraries: ,, + paths = $$split(line, $$QMAKE_DIRLIST_SEP) + for (path, paths): \ + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$replace(path, ^=, $$[SYSROOT])) + } + } + } isEmpty(QMAKE_DEFAULT_LIBDIRS)|isEmpty(QMAKE_DEFAULT_INCDIRS): \ !integrity: \ error("failed to parse default search paths from compiler output") -- cgit v1.2.3 From 16799ba394e0684cee8ca921432e418e1e0f6c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 7 Jul 2017 13:48:21 +0200 Subject: Only try to resolve library paths via linker for Drawin clang Task-number: QTBUG-61735 Change-Id: Ia8e777928aa0cff44f092968eac14d32501a5d73 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/toolchain.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mkspecs') diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index b3726a1160..813dbffbd4 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -50,11 +50,11 @@ isEmpty($${target_prefix}.INCDIRS) { rim_qcc: \ # Need the cc1plus and ld command lines to pick up the paths cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v - else: clang: \ + else: darwin:clang: \ # Need to link to pick up library paths cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v else: \ - # gcc is fine with just preprocessing + # Just preprocess, might not pick up library paths cxx_flags += -E -v output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec) -- cgit v1.2.3