summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-09-22 17:44:15 -0700
committerKhem Raj <raj.khem@gmail.com>2020-09-22 22:32:43 -0700
commit2730fe62d5d0af59d49bc2d8fe703753331aacf2 (patch)
treeb96446a29c97afde3691f2000e93f3184cd6c7b3 /README.md
parent3f67d272b387a86a82a6355bae9461d8b0fd3116 (diff)
downloadmeta-clang-2730fe62d5d0af59d49bc2d8fe703753331aacf2.tar.gz
README: Update documentation
Few knobs have changed and has not been yet reflected in README Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md61
1 files changed, 36 insertions, 25 deletions
diff --git a/README.md b/README.md
index 3990731..95cb5f8 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ bitbake-layers add-layer ../meta-clang
32 32
33Check `conf/bblayers.conf` to see that meta-clang is added to layer mix e.g. 33Check `conf/bblayers.conf` to see that meta-clang is added to layer mix e.g.
34 34
35# Default Compiler Switch 35# Default Compiler
36 36
37Note that by default gcc will remain the system compiler, however if you wish 37Note that by default gcc will remain the system compiler, however if you wish
38clang to be the default compiler then set 38clang to be the default compiler then set
@@ -47,45 +47,56 @@ you can select clang per recipe too by writing bbappends for them containing
47```shell 47```shell
48TOOLCHAIN = "clang" 48TOOLCHAIN = "clang"
49``` 49```
50also look at `conf/nonclangable.conf` for list of recipes which do not yet fully
51build with clang
50 52
51# Default C++ Standard Library Switch 53# Default Compiler Runtime
52 54
53Note that by default clang libc++ is default C++ standard library, however if you wish 55Default is to use GNU runtime `RUNTIME = "gnu"` which consists of libgcc, libstdc++ to provide C/C++
54to keep GNU libstdc++ to be the default then set 56runtime support. However its possible to use LLVM runtime to replace it where
57compile-rt, llvm libunwind, and libc++ are used to provide C/C++ runtime, while
58GNU runtime works with both GCC and Clang, LLVM runtime is only tested with Clang
59compiler, Switching to use LLVM runtime is done via a config metadata knob
55 60
56```shell 61```shell
57LIBCPLUSPLUS = "" 62RUNTIME = "llvm"
58``` 63```
59 64
60in `local.conf`. 65RUNTIME variable influences individual runtime elements and can be set explcitly as well
61You can select libstdc++ per package too by writing bbappends for them containing 66e.g. `LIBCPLUSPLUS` `COMPILER_RT` and `UNWINDLIB`
62 67
63```shell 68Please note that this will still use crt files from GNU compiler always, while llvm now
64LIBCPLUSPLUS_toolchain-clang_pn-<recipe> = "" 69do provide crt files, they have not been yet intergrated into toolchain
65```
66 70
67# Default Compiler Runtime ( Compiler-rt + libc++ ) 71# Default C++ Standard Library Switch
68 72
69By default, clang build from meta-clang uses clang runtime ( compiler-rt + libc++ + libunwind ) out of box 73Using RUNTIME bariable will select which C++ runtime is used, however it can be overridden
70However, it is possible to switch to using gcc runtime as default, In order to do that 74if needed to by modifying `LIBCPLUSPLUS` variable, usually defaults used by `RUNTIME` is
71following settings are needed in site configurations e.g. in `local.conf` 75best fit. e.g. below we select LLVM C++ as default C++ runtime.
72 76
73```shell 77```shell
74TOOLCHAIN ?= "clang" 78LIBCPLUSPLUS = "--stdlib=libc++"
75LIBCPLUSPLUS = "" 79```
76COMPILER_RT = "" 80
77UNWINDLIB = "" 81in `local.conf`.
82You can select libstdc++ per package too by writing bbappends for them containing
78 83
84```shell
85LIBCPLUSPLUS_toolchain-clang_pn-<recipe> = "--stdlibc=libc++"
79``` 86```
87Defaults are chosen to be GNU for maximum compatibility with existing GNU systems. Its always
88good to use single runtime on a system, mixing runtimes can cause complications during
89compilation as well as runtime. However, its upto distribution policies to decide which runtime
90to use.
80 91
81# Removing clang from generated SDK toolchain 92# Adding clang in generated SDK toolchain
82 93
83clang based cross compiler is automatically included into the generated SDK using `bitbake meta-toolchain` or 94clang based cross compiler is not included into the generated SDK using `bitbake meta-toolchain` or
84`bitbake -cpopulate_sdk <image>` in circumstanced where clang is not expected to be part of SDK, then reset `CLANGSDK` 95`bitbake -cpopulate_sdk <image>` if clang is expected to be part of SDK, add `CLANGSDK = "1"`
85variable in `local.conf` 96in `local.conf`
86 97
87```shell 98```shell
88CLANGSDK = "" 99CLANGSDK = "1"
89``` 100```
90 101
91# Building 102# Building
@@ -104,7 +115,7 @@ $ runqemu nographic
104# Limitations 115# Limitations
105 116
106Few components do not build with clang, if you have a component to add to that list 117Few components do not build with clang, if you have a component to add to that list
107simply add it to conf/nonclangable.inc e.g. 118simply add it to `conf/nonclangable.inc` e.g.
108 119
109```shell 120```shell
110TOOLCHAIN_pn-<recipe> = "gcc" 121TOOLCHAIN_pn-<recipe> = "gcc"
@@ -112,7 +123,7 @@ TOOLCHAIN_pn-<recipe> = "gcc"
112 123
113and OE will start using gcc to cross compile that recipe. 124and OE will start using gcc to cross compile that recipe.
114 125
115And if a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g. 126if a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g.
116 127
117```shell 128```shell
118CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ " 129CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ "