2 years, 3 months ago.

Any toolchain support for Clang compiler?

Is it possible to build Mbed (or at least Mbed-based application code) with the Clang toolchain instead of GCC?

I'm planning to port a fairly complex cross-platform C++ codebase to Mbed OS. We currently use Clang (on macOS or Linux) to target iOS and Android, and we've gotten it to build for Raspberry Pi in the past. We also use MSVC to build for Windows platforms.

I am not disparaging GCC! It's just that supporting multiple C++ compilers is a pain. They all have idiosyncrasies, missing features, sometimes bugs. Our codebase already has about 80 "#ifdef clang" and "#ifdef _MSC_VER" checks littered throughout. Moreover, performance-tuning is different for every toolchain since they all have slightly different sets of optimizations.

So in short, it would be great for our efficiency & sanity if we could keep using a compiler we already know and which successfully builds our code. Clang obviously already targets ARM, so is there much work to do to get it to build Mbed OS?

Be the first to answer this question.