Linux shared libraries with CMake and Bazel

A great introduction to shared libraries is available from Michael Kerrisk: * https://man7.org/conf/lca2006/shared_libraries/index.html A detailed analysis of shared libraries can be found in Ulrich Drepper's paper: * https://akkadia.org/drepper/dsohowto.pdf This paper is a must read if you want to understand…

Using toolchains in custom Bazel C++ rules

After writing a sketch of own C++ rules, which you can find here: * https://ltekieli.com/writing-custom-bazel-c-rules/, we might extend this example with toolchain support. In order to not conflict with existing C++ toolchain implementation we need to define a new toolchain type using a special rule: toolchain_type( name…

Writing custom Bazel C++ rules

Implementing a language support in Bazel can help one better understand the existing functionalities that this build system already provides. The migration process for Bazel C++ rules is still not finished at the moment, so the implementation for C++ rules is not fully done in starlark. We can try to…

Using Bazel aspects to run clang-format

Bazel's aspects are next to rules the major building block used to extend the functionality of your build system. Contrary to rules, aspects allow to run particular functionality over an existing dependency graph. Aspect are documented pretty well on the bazel documentation page: Aspects | BazelBazel [https://bazel.build/rules/aspects]…

Creating a custom OpenEmbedded distro

All the code that you can read below, can be found under: https://github.com/ltekieli/custom-oe-distro OpenEmbedded, Yocto, bitbake confusion. I have to admit that Yocto and OpenEmbedded were always quite confusing in terms of what is what, especially looking at the history of both and the integration decisions…

Cross compiling with Bazel

This time a short introduction to Bazel and how to cross-compile with this tool. I will explain how to build for host platform, as well as for multiple different targets. You can get the partial repositories used in this exercise here [https://github.com/ltekieli/bazel_cross_compile]. Installing Bazelisk…

Using a custom GCC toolchain for embedded Linux development

So previously [/using-crosstool-ng-to-generate-a-gcc-toolchain/] I shortly introduced how to build a custom toolchain, now it's time to put it to use. A bare toolchain is rarely sufficient enough to build useful applications. We usually depend on external libraries, whether it's boost, protobuf or any other piece of code. This time, let's…

Using crosstool-ng to generate a gcc toolchain

crosstool-ng [https://crosstool-ng.github.io/] is a handy tool for obtaining custom gcc toolchains which are tailored to your needs. This is especially useful when you are up to building a custom system for your embedded device, like a raspberry pi or a beagleboard. Building crosstool-ng itself crosstool-ng can be…