From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- external/meta-clang/README.md | 88 +++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 36 deletions(-) (limited to 'external/meta-clang/README.md') diff --git a/external/meta-clang/README.md b/external/meta-clang/README.md index 986f77c3..55413965 100644 --- a/external/meta-clang/README.md +++ b/external/meta-clang/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://drone.yoedistro.org/api/badges/kraj/meta-clang/status.svg)](https://drone.yoedistro.org/kraj/meta-clang) + # meta-clang (a C language family frontend and LLVM compiler backend) This layer provides [clang/llvm](http://clang.llvm.org/) as alternative to your system @@ -7,52 +9,74 @@ C/C++ compiler for OpenEmbedded based distributions along with gcc ```shell git clone git://github.com/openembedded/openembedded-core.git -cd openembeeded-core +cd openembedded-core git clone git://github.com/openembedded/bitbake.git git clone git://github.com/kraj/meta-clang.git $ . ./oe-init-build-env ``` -Edit conf/bblayers.conf to add meta-clang to layer mix e.g. - -```python -BBLAYERS ?= " \ - /home/kraj/openembedded-core/meta-clang \ - /home/kraj/openembedded-core/meta \ - " +Add meta-clang overlay +``` +bitbake-layers add-layer ../meta-clang ``` +Check `conf/bblayers.conf` to see that meta-clang is added to layer mix e.g. + # Default Compiler Switch Note that by default gcc will remain the system compiler, however if you wish clang to be the default compiler then set -```python +```shell TOOLCHAIN ?= "clang" ``` -in local.conf, this would now switch to using clang as default compiler systemwide -you can select clang per package too by writing bbappends for them containing +in `local.conf`, this would now switch default cross-compiler to be clang +you can select clang per recipe too by writing bbappends for them containing -```python +```shell TOOLCHAIN = "clang" ``` # Default C++ Standard Library Switch -Note that by default libstdc++ will remain the default C++ standard library, however if you wish -libc++ to be the default one then set +Note that by default clang libc++ is default C++ standard library, however if you wish +to keep GNU libstdc++ to be the default then set + +```shell +LIBCPLUSPLUS = "" +``` + +in `local.conf`. +You can select libstdc++ per package too by writing bbappends for them containing + +```shell +LIBCPLUSPLUS_toolchain-clang_pn- = "" +``` + +# Default Compiler Runtime ( Compiler-rt + libc++ ) + +By default, clang build from meta-clang uses clang runtime ( compiler-rt + libc++ + libunwind ) out of box +However, it is possible to switch to using gcc runtime as default, In order to do that +following settings are needed in site configurations e.g. in `local.conf` + +```shell +TOOLCHAIN ?= "clang" +LIBCPLUSPLUS = "" +COMPILER_RT = "" +UNWINDLIB = "" -```python -TARGET_CXXFLAGS_append_toolchain-clang ?= " -stdlib=libc++ " ``` -in local.conf. -You can select libc++ per package too by writing bbappends for them containing +# Removing clang from generated SDK toolchain -```python -TARGET_CXXFLAGS_append_toolchain-clang = " -stdlib=libc++ " +clang based cross compiler is automatically included into the generated SDK using `bitbake meta-toolchain` or +`bitbake -cpopulate_sdk ` in circumstanced where clang is not expected to be part of SDK, then reset `CLANGSDK` +variable in `local.conf` + +```shell +CLANGSDK = "" ``` # Building @@ -60,12 +84,12 @@ TARGET_CXXFLAGS_append_toolchain-clang = " -stdlib=libc++ " Below we build for qemuarm machine as an example ```shell -$ MACHINE=qemux86 bitbake core-image-minimal +$ MACHINE=qemuarm bitbake core-image-full-cmdline ``` # Running ```shell -$ runqemu qemux86 +$ runqemu nographic ``` # Limitations @@ -79,15 +103,15 @@ TOOLCHAIN_pn- = "gcc" and OE will start using gcc to cross compile that recipe. -And if a component does not build with libc++, you can add it to conf/nonclangable.inc e.g. +And if a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g. ```shell -TARGET_CXXFLAGS_remove_pn-_toolchain-clang = " -stdlib=libc++ " +CXX_remove_pn-_toolchain-clang = " -stdlib=libc++ " ``` # Dependencies -``` +```shell URI: git://github.com/openembedded/openembedded-core.git branch: master revision: HEAD @@ -97,17 +121,9 @@ branch: master revision: HEAD ``` -Send pull requests to openembedded-devel@lists.openembedded.org with '[meta-clang]' in the subject' - -When sending single patches, please use something like: - -'git send-email -M -1 --to openembedded-devel@lists.openembedded.org --subject-prefix=meta-clang][PATCH' +# Contributing -You are encouraged to fork the mirror on [github](https://github.com/kraj/meta-clang/) -to share your patches, this is preferred for patch sets consisting of more than -one patch. Other services like gitorious, repo.or.cz or self hosted setups are -of course accepted as well, 'git fetch ' works the same on all of them. -We recommend github because it is free, easy to use, has been proven to be reliable -and has a really good web GUI. +You are encouraged to follow Github Pull request workflow +to share changes and following commit message guidelines are recommended [OE patch guidelines](https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines) Layer Maintainer: [Khem Raj]() -- cgit 1.2.3-korg