xref: /OK3568_Linux_fs/yocto/meta-qt5/recipes-qt/qt5/qtpdf/0003-Fix-build-with-clang.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From b9ebaa970dbb050a51021a013e8d5b6d5aac86ab Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 26 Feb 2022 18:15:28 -0800
4Subject: [PATCH] Fix build with clang
5
6use GNU runtime when building native tools like gn
7when using native clang compiler
8
9Fixes
10| FAILED: gn
11| /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/qtpdf/5.15.8+gitAUTOINC+73e76f9e86_48a205f9e0-r0/recipe-sysroot-native/usr/bin/clang++ -O3 -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-stri
12p-all -Wl,--as-needed -pthread -o gn -Wl,--start-group tools/gn/gn_main.o base.a gn_lib.a -Wl,--end-group -ldl
13| /mnt/b/yoe/master/build/tmp/hosttools/ld: cannot find /usr/lib/clang/14.0.0/lib/linux/libclang_rt.builtins-x86_64.a: No such file or directory
14
15Fix building with clang from meta-clang
16
17Clang defaults to llvm runtime and this patch is needed
18for building the host tools, since its using native runtime
19
20Upstream-Status: Inappropriate [OE-Specific]
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
23---
24 src/buildtools/gn.pro | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro
28index 9632f0ef7..da85f8a26 100644
29--- a/src/buildtools/gn.pro
30+++ b/src/buildtools/gn.pro
31@@ -20,7 +20,7 @@ build_pass|!debug_and_release {
32
33             gn_gen_args = --no-last-commit-position --out-path $$out_path \
34                           --cc \"$$which($$CC_host)\" --cxx \"$$which($$CXX_host)\" \
35-                          --ld \"$$which($$CXX_host)\" --ar \"$$which(ar)\" \
36+                          --ld \"$$which($$CXX_host) -rtlib=libgcc -unwindlib=libgcc\" --ar \"$$which(ar)\" \
37                           --no-static-libstdc++
38
39             msvc:!clang_cl: gn_gen_args += --use-lto
40