diff options
| -rw-r--r-- | README.md | 28 |
1 files changed, 14 insertions, 14 deletions
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | This layer provides [clang/llvm](http://clang.llvm.org/) as alternative to system | 5 | This layer provides [clang/llvm](http://clang.llvm.org/) as alternative to system |
| 6 | C/C++ compiler for OpenEmbedded/Yocto Project based distributions. This can cohabit | 6 | C/C++ compiler for OpenEmbedded/Yocto Project based distributions. This can cohabit |
| 7 | with GNU Compiler and can be used for specific recipes or full system Compiler | 7 | with GNU compiler and can be used for specific recipes or full system compiler. |
| 8 | 8 | ||
| 9 | # Getting Started | 9 | # Getting Started |
| 10 | 10 | ||
| @@ -49,30 +49,30 @@ you can select clang per recipe too by writing bbappends for them containing | |||
| 49 | TOOLCHAIN = "clang" | 49 | TOOLCHAIN = "clang" |
| 50 | ``` | 50 | ``` |
| 51 | also look at `conf/nonclangable.conf` for list of recipes which do not yet fully | 51 | also look at `conf/nonclangable.conf` for list of recipes which do not yet fully |
| 52 | build with clang | 52 | build with clang. |
| 53 | 53 | ||
| 54 | # Default Compiler Runtime | 54 | # Default Compiler Runtime |
| 55 | 55 | ||
| 56 | Default is to use GNU runtime `RUNTIME = "gnu"` which consists of libgcc, libstdc++ to provide C/C++ | 56 | Default is to use GNU runtime `RUNTIME = "gnu"` which consists of libgcc, libstdc++ to provide C/C++ |
| 57 | runtime support. However its possible to use LLVM runtime to replace it where | 57 | runtime support. However it's possible to use LLVM runtime to replace it where |
| 58 | compile-rt, llvm libunwind, and libc++ are used to provide C/C++ runtime, while | 58 | compile-rt, llvm libunwind, and libc++ are used to provide C/C++ runtime, while |
| 59 | GNU runtime works with both GCC and Clang, LLVM runtime is only tested with Clang | 59 | GNU runtime works with both GCC and Clang, LLVM runtime is only tested with Clang |
| 60 | compiler, Switching to use LLVM runtime is done via a config metadata knob | 60 | compiler, switching to use LLVM runtime is done via a config metadata knob |
| 61 | 61 | ||
| 62 | ```shell | 62 | ```shell |
| 63 | RUNTIME = "llvm" | 63 | RUNTIME = "llvm" |
| 64 | ``` | 64 | ``` |
| 65 | 65 | ||
| 66 | RUNTIME variable influences individual runtime elements and can be set explcitly as well | 66 | RUNTIME variable influences individual runtime elements and can be set explicitly as well |
| 67 | e.g. `LIBCPLUSPLUS` `COMPILER_RT` and `UNWINDLIB` | 67 | e.g. `LIBCPLUSPLUS` `COMPILER_RT` and `UNWINDLIB`. |
| 68 | 68 | ||
| 69 | Please note that this will still use crt files from GNU compiler always, while llvm now | 69 | Please note that this will still use crt files from GNU compiler always, while llvm now |
| 70 | do provide crt files, they have not been yet intergrated into toolchain | 70 | do provide crt files, they have not been yet integrated into the toolchain. |
| 71 | 71 | ||
| 72 | # Default C++ Standard Library Switch | 72 | # Default C++ Standard Library Switch |
| 73 | 73 | ||
| 74 | Using RUNTIME bariable will select which C++ runtime is used, however it can be overridden | 74 | Using RUNTIME variable will select which C++ runtime is used, however it can be overridden |
| 75 | if needed to by modifying `LIBCPLUSPLUS` variable, usually defaults used by `RUNTIME` is | 75 | if needed to by modifying `LIBCPLUSPLUS` variable, usually defaults used by `RUNTIME` are |
| 76 | best fit. e.g. below we select LLVM C++ as default C++ runtime. | 76 | best fit. e.g. below we select LLVM C++ as default C++ runtime. |
| 77 | 77 | ||
| 78 | ```shell | 78 | ```shell |
| @@ -85,14 +85,14 @@ You can select libstdc++ per package too by writing bbappends for them containin | |||
| 85 | ```shell | 85 | ```shell |
| 86 | LIBCPLUSPLUS:toolchain-clang:pn-<recipe> = "-stdlibc=libc++" | 86 | LIBCPLUSPLUS:toolchain-clang:pn-<recipe> = "-stdlibc=libc++" |
| 87 | ``` | 87 | ``` |
| 88 | Defaults are chosen to be GNU for maximum compatibility with existing GNU systems. Its always | 88 | Defaults are chosen to be GNU for maximum compatibility with existing GNU systems. It's always |
| 89 | good to use single runtime on a system, mixing runtimes can cause complications during | 89 | good to use single runtime on a system, mixing runtimes can cause complications during |
| 90 | compilation as well as runtime. However, its upto distribution policies to decide which runtime | 90 | compilation as well as runtime. However, it's up to distribution policies to decide which runtime |
| 91 | to use. | 91 | to use. |
| 92 | 92 | ||
| 93 | # Adding clang in generated SDK toolchain | 93 | # Adding clang in generated SDK toolchain |
| 94 | 94 | ||
| 95 | clang based cross compiler is not included into the generated SDK using `bitbake meta-toolchain` or | 95 | Clang based cross compiler is not included into the generated SDK using `bitbake meta-toolchain` or |
| 96 | `bitbake -cpopulate_sdk <image>` if clang is expected to be part of SDK, add `CLANGSDK = "1"` | 96 | `bitbake -cpopulate_sdk <image>` if clang is expected to be part of SDK, add `CLANGSDK = "1"` |
| 97 | in `local.conf` | 97 | in `local.conf` |
| 98 | 98 | ||
| @@ -124,7 +124,7 @@ TOOLCHAIN:pn-<recipe> = "gcc" | |||
| 124 | 124 | ||
| 125 | and OE will start using gcc to cross compile that recipe. | 125 | and OE will start using gcc to cross compile that recipe. |
| 126 | 126 | ||
| 127 | if a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g. | 127 | If a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g. |
| 128 | 128 | ||
| 129 | ```shell | 129 | ```shell |
| 130 | CXX:remove:pn-<recipe>:toolchain-clang = " -stdlib=libc++ " | 130 | CXX:remove:pn-<recipe>:toolchain-clang = " -stdlib=libc++ " |
| @@ -179,6 +179,6 @@ revision: HEAD | |||
| 179 | # Contributing | 179 | # Contributing |
| 180 | 180 | ||
| 181 | You are encouraged to follow Github Pull request workflow | 181 | You are encouraged to follow Github Pull request workflow |
| 182 | to share changes and following commit message guidelines are recommended [OE patch guidelines](https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines) | 182 | to share changes and following commit message guidelines are recommended: [OE patch guidelines](https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines). |
| 183 | 183 | ||
| 184 | Layer Maintainer: [Khem Raj](<mailto:raj.khem@gmail.com>) | 184 | Layer Maintainer: [Khem Raj](<mailto:raj.khem@gmail.com>) |
