I have recently been trying to cross-compile programs for ARM. However, when I run make, I always get an error within a minute or less that says something like

/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lgio-2.0.

The thing that confuses me is that I get that error every time I try to cross-compile a program (except it doesn't always say that it can't find -lgio-2.0. It has trouble finding other things too). Is there something I'm doing wrong? Why is it always this error? The only program I have been able to successfully cross-compile is bash, but I've had problems with everything else. What do I do? I have all of the libraries and things installed, as I am able to natively compile the programs just fine.

  • 1
    Do you have the ARM versions of any of these packages installed? packages.ubuntu.com/…
    – muru
    Apr 20, 2015 at 21:38
  • @muru No. How do I get ARM versions of packages? My repos only contain AMD64 and i386 packages. (Sorry, I'm new to cross-compiling.)
    – John Scott
    Apr 20, 2015 at 21:45

2 Answers 2


As mentioned by muru. You need to install the ARM architecture of that library. However they are not listed on http://packages.ubuntu.com site. Neither, it's easy to manage dependencies manually that way.

Note: Setup a chroot environment, I found weird behavior when I added armhf architecture to my Ubuntu 15.04 amd64. I used dpkg --add-architecture=armhf. The APT start complaining about broken package wine and tried to remove all i386 packages.

  1. Add new sources file

    sudo nano /etc/apt/sources.list.d/arm-repo.list

    Add the source of the architecture you want and release you have.

    deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports trusty main universe

    Check for available arch here: http://ports.ubuntu.com/ubuntu-ports/dists/trusty/main/ as you can browse up/down for different releases.

  2. Update package list

    sudo apt-get update
  3. Add a dpkg configuration

    sudo nano /etc/dpkg/dpkg.cfg.d/multiarch

    with this line

    foreign-architecture armhf
  4. Install need packages as needed, example:

    sudo apt-get install libglib2.0-0:armhf


  • Doesn't work with Ubuntu 18.04 (and later). I get dpkg: error: configuration error: /etc/dpkg/dpkg.cfg.d/multiarch:1: unknown option 'foreign-architecture' and libglib2.0-0:armhf : Depends: libc6:armhf (>= 2.28) but it is not going to be installed,... etc.
    – Aenfa
    May 21, 2021 at 21:58

You can also download the package, cross-compile it using arm-linux-gnueabihf and place the libraries in the corresponding folders of the arm-linux-gnueabihf compiler directory in /usr/

  • Welcome to Ask Ubuntu! Can you edit this with more information on how to do that? Jan 12, 2017 at 6:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .