4

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 '15 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 '15 at 21:45
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
    

References:

0

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? – Eliah Kagan Jan 12 '17 at 6:18

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.