All Projects → kraj → Meta Clang

kraj / Meta Clang

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

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Meta Clang

open-ops
Open Optimizing Parallelizing System
Stars: ✭ 21 (-72.37%)
Mutual labels:  llvm, clang, compilers
Gllvm
Whole Program LLVM: wllvm ported to go
Stars: ✭ 126 (+65.79%)
Mutual labels:  llvm, clang, compilers
Proton Clang
Proton Clang toolchains builds in the form of a continuously updating Git repository. Clone with --depth=1.
Stars: ✭ 126 (+65.79%)
Mutual labels:  llvm, clang, cross-compiler
Optviewer Demo
Demonstration of LLVM's opt-viewer tool
Stars: ✭ 63 (-17.11%)
Mutual labels:  llvm, clang, compilers
Swiftweekly.github.io
A community-driven weekly newsletter about Swift.org
Stars: ✭ 305 (+301.32%)
Mutual labels:  llvm, clang
Clang Power Tools
Bringing clang-tidy magic to Visual Studio C++ developers.
Stars: ✭ 285 (+275%)
Mutual labels:  llvm, clang
Enzyme
High-performance automatic differentiation of LLVM.
Stars: ✭ 418 (+450%)
Mutual labels:  llvm, clang
Seeless
C IDE for iOS
Stars: ✭ 71 (-6.58%)
Mutual labels:  llvm, clang
llvm-project-prepo
Fork of LLVM with modifications to support a program repository
Stars: ✭ 27 (-64.47%)
Mutual labels:  llvm, clang
Fcd
An optimizing decompiler
Stars: ✭ 622 (+718.42%)
Mutual labels:  llvm, clang
Woboq codebrowser
Woboq CodeBrowser
Stars: ✭ 837 (+1001.32%)
Mutual labels:  llvm, clang
Olifant
A simple programming language targeting LLVM
Stars: ✭ 58 (-23.68%)
Mutual labels:  llvm, clang
clang-format-editor
Clang-Format Editor is a tool that helps you find the best Clang-Format Style for your C++, C#, Java, JavaScript, and Objective-C code.
Stars: ✭ 15 (-80.26%)
Mutual labels:  llvm, clang
Clangkit
ClangKit provides an Objective-C frontend to LibClang. Source tokenization, diagnostics and fix-its are actually implemented.
Stars: ✭ 330 (+334.21%)
Mutual labels:  llvm, clang
llvm-svn
Arch Linux PKGBUILD for LLVM, Clang et al. (latest SVN code)
Stars: ✭ 18 (-76.32%)
Mutual labels:  llvm, clang
Llvm Tutor
A collection of out-of-tree LLVM passes for teaching and learning
Stars: ✭ 941 (+1138.16%)
Mutual labels:  llvm, compilers
Cxxctp
DEPRECATED. USE INSTEAD github.com/blockspacer/flextool
Stars: ✭ 58 (-23.68%)
Mutual labels:  llvm, clang
Llvm 9.0 Learner Tutorial
A blog for LLVM(v9.0.0 or v11.0.0) beginner, step by step, with detailed documents and comments. Record the way I learn LLVM and accomplish a complete project for FPGA High-Level Synthesis with it.
Stars: ✭ 58 (-23.68%)
Mutual labels:  llvm, clang
Zapcc
zapcc is a caching C++ compiler based on clang, designed to perform faster compilations
Stars: ✭ 1,109 (+1359.21%)
Mutual labels:  llvm, clang
arch-packages
Arch Linux performance important packages
Stars: ✭ 27 (-64.47%)
Mutual labels:  llvm, clang

Yoe Distro CI

meta-clang (C/C++ frontend and LLVM compiler backend)

This layer provides clang/llvm as alternative to system C/C++ compiler for OpenEmbedded/Yocto Project based distributions. This can cohabit with GNU Compiler and can be used for specific recipes or full system Compiler

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

If using poky ( Yocto project reference Distribution )

git clone https://git.yoctoproject.org/git/poky
cd poky
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

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"

also look at conf/nonclangable.conf for list of recipes which do not yet fully build with clang

Default Compiler Runtime

Default is to use GNU runtime RUNTIME = "gnu" which consists of libgcc, libstdc++ to provide C/C++ runtime support. However its possible to use LLVM runtime to replace it where compile-rt, llvm libunwind, and libc++ are used to provide C/C++ runtime, while GNU runtime works with both GCC and Clang, LLVM runtime is only tested with Clang compiler, Switching to use LLVM runtime is done via a config metadata knob

RUNTIME = "llvm"

RUNTIME variable influences individual runtime elements and can be set explcitly as well e.g. LIBCPLUSPLUS COMPILER_RT and UNWINDLIB

Please note that this will still use crt files from GNU compiler always, while llvm now do provide crt files, they have not been yet intergrated into toolchain

Default C++ Standard Library Switch

Using RUNTIME bariable will select which C++ runtime is used, however it can be overridden if needed to by modifying LIBCPLUSPLUS variable, usually defaults used by RUNTIME is best fit. e.g. below we select LLVM C++ as default C++ runtime.

LIBCPLUSPLUS = "--stdlib=libc++"

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

LIBCPLUSPLUS_toolchain-clang_pn-<recipe> = "--stdlibc=libc++"

Defaults are chosen to be GNU for maximum compatibility with existing GNU systems. Its always good to use single runtime on a system, mixing runtimes can cause complications during compilation as well as runtime. However, its upto distribution policies to decide which runtime to use.

Adding clang in generated SDK toolchain

clang based cross compiler is not included into the generated SDK using bitbake meta-toolchain or bitbake -cpopulate_sdk <image> if clang is expected to be part of SDK, add CLANGSDK = "1" in local.conf

CLANGSDK = "1"

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.

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].