Coder Social home page Coder Social logo

lorenzph / meta-clang Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kraj/meta-clang

0.0 1.0 0.0 1.58 MB

Clang C/C++ cross compiler and runtime for OpenEmbedded/Yocto Project

License: MIT License

BitBake 85.25% Shell 3.16% HTML 7.42% PHP 2.52% C++ 1.66%

meta-clang's Introduction

Build Status

meta-clang (a C language family frontend and LLVM compiler backend)

This layer provides clang/llvm as alternative to your system C/C++ compiler for OpenEmbedded based distributions along with gcc

Getting Started

git clone git://github.com/openembedded/openembedded-core.git
cd openembedded-core
git clone git://github.com/openembedded/bitbake.git
git clone git://github.com/kraj/meta-clang.git

$ . ./oe-init-build-env

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

TOOLCHAIN ?= "clang"

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

TOOLCHAIN = "clang"

Default C++ Standard Library Switch

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

LIBCPLUSPLUS = ""

in local.conf. You can select libstdc++ per package too by writing bbappends for them containing

LIBCPLUSPLUS_toolchain-clang_pn-<recipe> = ""

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

TOOLCHAIN ?= "clang"
LIBCPLUSPLUS = ""
COMPILER_RT = ""
UNWINDLIB = ""

Removing clang from generated SDK toolchain

clang based cross compiler is automatically included into the generated SDK using bitbake meta-toolchain or bitbake -cpopulate_sdk <image> in circumstanced where clang is not expected to be part of SDK, then reset CLANGSDK variable in local.conf

CLANGSDK = ""

Building

Below we build for qemuarm machine as an example

$ MACHINE=qemuarm bitbake core-image-full-cmdline

Running

$ runqemu nographic

Limitations

Few components do not build with clang, if you have a component to add to that list simply add it to conf/nonclangable.inc e.g.

TOOLCHAIN_pn-<recipe> = "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.

CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ "

Dependencies

URI: git://github.com/openembedded/openembedded-core.git
branch: master
revision: HEAD

URI: git://github.com/openembedded/bitbake.git
branch: master
revision: HEAD

Contributing

You are encouraged to follow Github Pull request workflow to share changes and following commit message guidelines are recommended OE patch guidelines

Layer Maintainer: Khem Raj

meta-clang's People

Contributors

anujm1 avatar cosmo0920 avatar danieldittmann avatar dankm avatar dburnsii avatar dl9pf avatar dsacre avatar dwrobel avatar hongxu-jia avatar ipuustin avatar jpuhlman avatar jsbronder avatar jyong2 avatar kergoth avatar kraj avatar lorac avatar mastag avatar mrchapp avatar mythi avatar opanait-wr avatar otavio avatar rchard2scout avatar ribalda avatar romanek-adam avatar rossburton avatar saininav avatar sakoman avatar shr-project avatar tworaz avatar walkthetalk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.