From 28b09e78f5d44ab696e32bc924e527b068da2202 Mon Sep 17 00:00:00 2001 From: Vasily Date: Thu, 9 Apr 2020 13:06:14 +0200 Subject: [PATCH] Update Linux compiler selection with linker Qmake attempts to invoke the linker with the default `g++` binary even when we changed the binary. This will compile error when using LTO. For clang: ``` /usr/bin/ld.gold: error: /usr/lib/llvm-3.8/bin/../lib/LLVMgold.so: could not load plugin library: /usr/lib/llvm-3.8/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ``` For GCC: ``` lto1: fatal error: bytecode stream generated with LTO version 6.0 instead of the expected 4.1 ``` --- build_scripts/qt/compilers/clang.pri | 4 ++++ build_scripts/qt/compilers/gcc.pri | 3 +++ 2 files changed, 7 insertions(+) diff --git a/build_scripts/qt/compilers/clang.pri b/build_scripts/qt/compilers/clang.pri index db2197c..b769be0 100644 --- a/build_scripts/qt/compilers/clang.pri +++ b/build_scripts/qt/compilers/clang.pri @@ -18,18 +18,22 @@ else { message('clang' version is not above 4. Attempting to use highest specific version.) system("clang-5 --version") { QMAKE_CXX = clang-5 + QMAKE_LINK = clang-5 message('clang-5' found.) } system("clang-6 --version") { QMAKE_CXX = clang-6 + QMAKE_LINK = clang-6 message('clang-6' found.) } system("clang-7 --version") { QMAKE_CXX = clang-7 + QMAKE_LINK = clang-7 message('clang-7' found.) } system("clang-8 --version") { QMAKE_CXX = clang-8 + QMAKE_LINK = clang-8 message('clang-8' found.) } } diff --git a/build_scripts/qt/compilers/gcc.pri b/build_scripts/qt/compilers/gcc.pri index f3e2f7a..31cb07b 100644 --- a/build_scripts/qt/compilers/gcc.pri +++ b/build_scripts/qt/compilers/gcc.pri @@ -7,14 +7,17 @@ else { system(g++-7 --version) { message('g++-7' found.) QMAKE_CXX = g++-7 + QMAKE_LINK = g++-7 } system(g++-8 --version) { message('g++-8' found.) QMAKE_CXX = g++-8 + QMAKE_LINK = g++-8 } system(g++-9 --version) { message('g++-9' found.) QMAKE_CXX = g++-9 + QMAKE_LINK = g++-9 } }