1From 7ae73da23ad998bd1e63ad213cf7a02e61191951 Mon Sep 17 00:00:00 2001
2From: Romain Naour <romain.naour@gmail.com>
3Date: Sat, 23 May 2020 19:01:19 +0200
4Subject: [PATCH] gn.pro: don't link statically with libstc++
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9While cross-compiling, qt5webengine is building a host tool but
10want to link the libstdc++ statically. This requires to install
11libstdc++-static package on the host (Fedora package name).
12
13Otherwise the link fail with:
14
15  [185/185] LINK gn
16  FAILED: gn
17  /usr/bin/g++ -O3 -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-strip-all -Wl,--as-needed -static-libstdc++ -pthread -o gn -Wl,--start-group tools/gn/gn_main.o base.a gn_lib.a -Wl,--end-group -ldl
18  /usr/bin/ld : unable to find -lstdc++
19  [...]
20  Project ERROR: GN build error!
21
22Add --no-static-libstdc++ argument to gn.pro to link to
23libstdc++.so.6 instead of libstdc++.a.
24
25--no-static-libstdc++ has been added by [1] but it force
26linking statically by default.
27
28[1] https://github.com/qt/qtwebengine-chromium/commit/cfab9198a9917f42cf08b1caf84ab9b71aac1911#diff-905c8f054808213577c0a92d1b704615
29
30Signed-off-by: Romain Naour <romain.naour@gmail.com>
31---
32 src/buildtools/gn.pro | 3 ++-
33 1 file changed, 2 insertions(+), 1 deletion(-)
34
35diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro
36index 033202e6..5dd8e241 100644
37--- a/src/buildtools/gn.pro
38+++ b/src/buildtools/gn.pro
39@@ -20,7 +20,8 @@ build_pass|!debug_and_release {
40
41             gn_gen_args = --no-last-commit-position --out-path $$out_path \
42                           --cc \"$$which($$QMAKE_CC)\" --cxx \"$$which($$QMAKE_CXX)\" \
43-                          --ld \"$$which($$QMAKE_LINK)\"
44+                          --ld \"$$which($$QMAKE_LINK)\" \
45+                          --no-static-libstdc++
46
47             msvc:!clang_cl: gn_gen_args += --use-lto
48
49--
502.25.4
51
52