2

I was wondering if one can compile binaries on Armbian to be used on Raspbian (without using cross-compilation tools)? Is there binary compatibility? Do I need to link libraries statically (would that even work?)?

My idea was to get a Armbian machine with 2 GB (not the Raspberry, thus) and use this as a simple strategy to compile stuff that needs more than 1GB to compile.

5

In short, Yes, they will work. Both repositories use the same upstream code to build their packages.

That is, armhf binaries from armbian will run on an armhf raspbian.

Your problem won't binary compatibility but dependency compatibility. Using a statically linked executable will resolve the dependency compatibility at the expense of binary size.


Debian packages are compiled against dependencies as they exist in the repository. That is, if you're application needs glibc, debian will use the glibc dependency from that release.

Imagine this scenario, two packages

Raspbian: MyApplication-1.0~raspbian built against glibc-X.Y~raspbian

Armbian: MyApplication-1.0~armbian built against glibc-A.B~armbian

If there are differences between the two versions of glibc, then if you install MyApplication-1.0~armbian.deb on a raspbian system, you will likely have an error when starting the application or a bug of some sort that may crop up.

If the dependencies are equivalent or compatible, then the package will work as intended.

You can, if you like, choose to install all the armbian dependencies for a given package by simply adding the armbian repos to /etc/apt/sources.list, however this will potential conflict with raspbian versions of the same packages, causing a broken system

There are a few further complications, for example there are build dependencies build-dep which are seperate from package runtime dependencies


The proper way to do this is to port the package by rebuilding the armbian package from source against the raspbian dependencies. This is not guaranteed to succeed (sometimes things are actually incompatible), but when done correctly is very reliable.

This is basically what is used to create backport repositories in desktop ubuntu/debian

Explaining how to build debian packages from scratch is outside the scope of this question, but I would point you to my answer on ubuntu.se for an introduction to what it takes.

Building packages can be done on a desktop pc with the proper cross-compile or on Raspberry with native compiler.

  • My apologies, I had interpreted the question as being about repo packages. I will leave the answer up since it may still be useful, In any case cross-compilation is very simple but confusing and I would recommend you learn how to use it. – crasic Nov 13 '17 at 21:33
  • My first attempt was doing cross-compilation but run into problems. I will do a separate question on this – Tiago Antao Nov 13 '17 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.