Getting Started with MultiArch (armel / armhf) in Ubuntu

Orange Pi Development Boards

Until now, I used xapt and dpkg-cross to install cross libraries for armel, but since I’ve upgraded to Ubuntu 12.04, it appears to be broken. I’ve contacted Linaro about this issue, and the “cross-building” expert at Linaro (wookey) recommended me to use multiarch instead, as xapt/dpkg-cross will be eventually deprecated.

He provided me an example showing how-to use multiarch to build Chromium. I’ve been looking for a “How-to multiarch”, but haven’t been able to find something really clear and simple, so I thought I would post it here.

In the example, they used a chroot for cross-building, which is probably a good idea to avoid messing up with the system. It’s also possible multiarch is not 100% reliable, and I’ve read stories where people messed up their system when using multiarch with i386 (32-bit) and amd64 (64-bit).

Preparing a chroot for cross-building

I’ll use a 32-bit Ubuntu precise chroot, but you can use an older distribution (e.g. oneric) and 64-bit if needed:


Setup the /etc/apt/sources.list:


The file above is setup for armel, but you could also set it up for armhf or both [arch=armel,armhf].

Some packages might not be in precise, so it’s better to create /etc/apt/sources.list.d/linaro-maintainers.list to add Linaro ppas:


Import the public key of the Overlay, to avoid the GPG error while accessing the PPA:


dpkg --add-architecture is not available in the dpkg available in Ubuntu 12.04, so you’ll need to enable multiarch for dpkg manually in /etc/dpkg/dpkg.cfg.d/multiarch:


Create /etc/apt/apt.conf.d/10local to disable installing recommended and suggested packages:


Create /usr/sbin/policy-rc.d file to prevent daemons to start in the chroot:


Install linaro arm cross-toolchain and essentials:

Installing armel packages

Now that your chroot is ready, it’s pretty simple to install armel packages as you just need to append the architecture after the package name, for example:


The libraries are installed in /usr/lib/arm-linux-gnueabi/ and the header files are shared among all architectures in /usr/include, except for armel specific bits which are in /usr/include/arm-linux-gnueabi. If you use armhf instead the libraries will be located in /usr/lib/arm-linux-gnueabihf/.

If you are building your own software, you can just install the dependencies you need and set the CFLAGS, CXXFLAGS and LDFLAGS to the paths above.

Building known packages

Another great feature of multiarch is that you can build known packages with dpkg-buildpackage. When everything works perfectly, you’ll just need to run something like:


In the example above, once you’ve configured apt for multiarch, you just need to type 4 commands to retrieve the source and build the chromium-browser for ARM.

I’ve already used this method when building the Linux ARM kernel on Ubuntu 12.04.

18
Leave a Reply

avatar
18 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
8 Comment authors
Unix/Linux:Can one install an armel Ubuntu package on armhf Ubuntu system? – Unix QuestionsCan One Install An Armel Ubuntu Package On Armhf Ubuntu System? | Click & Find Answer !aravindByung JangAline Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Nikolay Nikolaev
Guest
Nikolay Nikolaev

That’s very useful, thanks for sharing the information.

I use schroot for these things. It integrates perfectly in the environment (automatically mounts what’s needed – dev, proc etc.).
Here’s an excerpt from my /etc/schroot/schroot.conf that shows 32bit chroot on my 64 bit box

[precise32]
description=Precise Pangolin 32
directory=/chroots/precise32
type=directory
users=
root-groups=root
personality=linux32

Then as a regular user:
schroot -c precise32

Nikolay Nikolaev
Guest
Nikolay Nikolaev

@ cnxsoft
And this is the ‘Precise” manpage (you gave the ‘Hardy’ one):

http://manpages.ubuntu.com/manpages/precise/man1/schroot.1.html

cheers

trackback

[…] but it’s broken for Ubuntu 12.04, at least on my system. I’ve been told to switch to multiarch because this will be how it’s done from now on. But I soon discovered this is work in […]

Markus
Guest
Markus

Small nits in the description:

**
deb-src http://archive.ubuntu.com/ubuntu price main universe
->
deb-src http://archive.ubuntu.com/ubuntu precise main universe

**
apt-get update apt-get install g++-arm-linux-gnueabi build-essential
->
apt-get update
apt-get install g++-arm-linux-gnueabi build-essential

Aline
Guest
Aline

Hello

can i install some packages for arm like broser chromium and libxml2 and after can i transfer this to the arm machine ???

thank you

Aline
Guest
Aline

@cnxsoft

i dont have a command apt-get to install in my machine ARM what is the solution ??

Aline
Guest
Aline

Hello,

when i execute apt-get build-dep -a armel chromium-browser

i get an error didnt find chromium-browser package

Reading state information… Done
E: Unable to find a source package for chromium-brwoser

Aline
Guest
Aline

@cnxsoft

My Problem is i need to compile and install the chromium-browser for arm architecture .
when i run apt-get install chromium-browser:armel i dont have any output to make in the target arm
if you have idea about haw can i run apt-get install chromium-browser:arme and befor haw i can make the chromium-browser in my target arm

Byung Jang
Guest
Byung Jang

There is a typo in “deb-src http://archive.ubuntu.com/ubuntu price main universe”. “price” should be “precise”, I think.

aravind
Guest
aravind

Hi , when i’m try install armel packages using apt-get install libjpeg-dev:armel libpng12-dev:armel
its throwing following error, Can any one suggest me how to resolve those errors

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libjpeg-turbo8-dev:armel’ instead of ‘libjpeg-dev:armel’
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libjpeg-turbo8-dev:armel : Depends: libjpeg-turbo8:armel (= 1.1.90+svn733-0ubuntu4) but it is not going to be installed
Depends: libc-dev:armel
libpng12-dev:armel : Depends: libpng12-0:armel (= 1.2.46-3ubuntu4) but it is not going to be installed
Depends: zlib1g-dev:armel but it is not going to be installed
openssh-client : Depends: libedit2 (>= 2.11-20080614-1) but it is not going to be installed
Recommends: xauth but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

trackback

[…] This should be possible with recent versions of Debian (≥ wheezy) or Ubuntu (≥ 11.10 oneiric), thanks to Multiarch support. The Debian packaging tools support installing packages from more than one architecture on the same system. You would be effectively installing two parallel systems, one with programs and libraries compiled for armhf and one with programs and libraries compiled from armel. Note that I’m not speaking from personal experience for the armel/armhf combination; it is supposed to work, but I don’t know if all the bugs have been ironed out yet (the multiarch combination that gets the most attention is amd64/i386). There are success or experience reports: Linaro mailing list thread, blog post by cnxsoft. […]

trackback

[…] This should be possible with recent versions of Debian (≥ wheezy) or Ubuntu (≥ 11.10 oneiric), thanks to Multiarch support. The Debian packaging tools support installing packages from more than one architecture on the same system. You would be effectively installing two parallel systems, one with programs and libraries compiled for armhf and one with programs and libraries compiled from armel. Note that I’m not speaking from personal experience for the armel/armhf combination; it is supposed to work, but I don’t know if all the bugs have been ironed out yet (the multiarch combination that gets the most attention is amd64/i386). There are success or experience reports: Linaro mailing list thread, blog post by cnxsoft. […]