Understanding and fixing cross-compilation requirements

How to make your FOSS project cross-compilation friendly

Robert Schuster

Playlists: 'froscon2009' videos starting here / audio

This lecture talks about the typical problems embedded build environments have with the build systems of random FOSS projects out there. It will also present best practices to fix them. As such this lecture contributes to better cross-compile support in the general FOSS community.

The ideas presented here are not related to any build environment in special and instead will solve the problem for all of them.

GNU/Linux on embedded systems is an enormously hot topic. Every month new and better hardware is presented. These systems often use either an ARM, MIPS or PowerPC CPU and run a Linux-based operating system on it. Much to our luck many of the devices that are introduced lately are supporting the sharing spirit of the FOSS community. As such their designers provide access to specifications, schematics and bills of materials.

The number of people that tinker with these devices is steadily growing. A nice way to see what these people are currently working on is the website http://scap.linuxtogo.org .

You are an author or contributor to some FOSS project out there and wonder why your project has not appeared there. Or perhaps you are going to buy such a device in the near future and would like to know what it takes to get your application running on it.

The approach taken by the major embedded build systems like OpenEmbedded, OpenWRT or T2 SDE is cross-compiling. This process was deemed complicated, somewhat diffuse and incomprehensable. In the past it required setting up a cross-compilation toolchain manually - which is still a cumbersome task and so many refrained from trying it at all. With the advent of the mentioned build enviromnents such manual work is no longer neccessary for the casual embedded user.

Unfortunately the principles of cross-compiling and its special requirements are by any means no common knowledge. Contributors to embedded build environments are confronted with that nuisance everytime they want to include support for the more complicated FOSS applications out there: The build scripts are full of assumptions which are invalid in a cross-compile context. Custom fixes are used which are hard to come by. Worst of all, some projects even chose to use a completely custom build scripts.

With this lecture you will get to know the common pitfalls in cross-compiling and how to solve them. Equipped with that knowledge you will better understand how to write the build scripts of your project in a way that they support cross-compiling out of the box. Perhaps it will also make you better understand when packagers from the named embedded build environment make requests in your bugtracker. :)

The lecture is being hold by someone who contributes to OpenEmbedded. However the best practices presented here will in the end benefit everyone who uses your project in a cross-compile context.

The main target of this lecture are contributors to FOSS projects which develop a pieced of software in a langauge that needs to be statically compiled like C oder C++. However if - regardless of programming language - your project contains non-trivial or custom means to find and include build dependencies during its build, this lecture is also for you.

Download

Embed

Share:

Tags