2

I want to set up a cross-compiling environment for Phidget's SBC. libphidget needs libusb-1.0-0 and libusb-1.0-0-dev, and currently it doesn't find those:

~/Softwares/libphidget-2.1.8.20151217 $ ./configure --prefix=/usr/arm-linux-gnueabi --host=arm-linux-gnueabi
[...]
checking for library containing libusb_init... no
checking for library containing usb_find_busses... no
configure: error: Missing libusb!

What I have tried:

I have those libs for my arch (amd64), and I've tried to install for armel. I added the arch through dpkg

$ dpkg --print-foreign-architectures
i386
armel

$ apt-config dump |grep -i arch
APT::Architecture "amd64";
APT::Architectures "";
APT::Architectures:: "amd64";
APT::Architectures:: "i386";
APT::Architectures:: "armel";

then added the source (through a search on launchpad.net, I found those packages and arch to be in Precise: deb [arch=armel,armhf] http://ports.ubuntu.com/ubuntu-ports precise main universe), and finally tried to install through the repositories:

$ apt-cache policy libusb-1.0.0:armel
libusb-1.0-0:armel:
  Installé : (aucun)
  Candidat : 2:1.0.9~rc3-2ubuntu1
 Table de version :
     2:1.0.9~rc3-2ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports precise/main armel Packages
libusb-1.0-0-dev:armel:
  Installé : (aucun)
  Candidat : 2:1.0.9~rc3-2ubuntu1
 Table de version :
     2:1.0.9~rc3-2ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports precise/main armel Packages

$ luneart@luneart-Lenovo-renew ~ $ sudo apt-get install libusb-1.0-0-dev:armel libusb-1.0-0:armel
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Certains paquets ne peuvent être installés. Ceci peut signifier que vous avez demandé l'impossible, ou bien, si vous utilisez la distribution unstable, que certains paquets n'ont pas encore été créés ou ne sont pas sortis d'Incoming.
L'information suivante devrait vous aider à résoudre la situation : 

Les paquets suivants contiennent des dépendances non satisfaites :
 libusb-1.0-0:armel : Dépend: libc6:armel (>= 2.8) mais ne sera pas installé
 libusb-1.0-0-dev:armel : Dépend: libc6-dev:armel mais ne sera pas installé ou
                                  libc-dev:armel
E: Impossible de corriger les problèmes, des paquets défectueux sont en mode « garder en l'état ».

It doesn't install anything because it misses armel's libc6 dependencies, though it should resolve those. I tried to find cross package for libc6 (I first searched for libusb cross packages, but didn't find any):

$ apt-cache search libc6 armel
libc6-armhf - Embedded GNU C Library: ARM hard float shared libraries for armel
libc6-dev - Embedded GNU C Library: Development Libraries and Header Files
libc6-dev-armhf - Embedded GNU C Library: ARM hard float development libraries for armel
libc6 - GNU C Library: Shared libraries
libc6-dbg-armel-cross - GNU C Library: detached debugging symbols (for cross-compiling)
libc6-armel-armhf-cross - Dummy package to get libc6:armel installed
libc6-armel-cross - GNU C Library: Shared libraries (for cross-compiling)
libc6-armhf-armel-cross - Dummy package to get libc6:armhf installed
libc6-dev-armel-armhf-cross - Dummy package to get libc6-dev:armel installed
libc6-dev-armel-cross - GNU C Library: Development Libraries and Header Files (for cross-compiling)
libc6-dev-armhf-armel-cross - Dummy package to get libc6-dev:armhf installed

Then I installed those, starting with libc6-armel-cross:

dpkg -l libc6*
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom                     Version          Architecture     Description
+++-=======================-================-================-===================================================
ii  libc6:amd64             2.23-0ubuntu4    amd64            GNU C Library: Shared libraries
ii  libc6:i386              2.23-0ubuntu4    i386             GNU C Library: Shared libraries
un  libc6-amd64             <aucune>         <aucune>         (aucune description n'est disponible)
un  libc6-armel-armel-cross <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-armel-armhf-cross 2.23-0ubuntu3cro all              Dummy package to get libc6:armel installed
ii  libc6-armel-cross       2.23-0ubuntu3cro all              GNU C Library: Shared libraries (for cross-compilin
un  libc6-armel-dcv1        <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-armhf-armel-cross 2.23-0ubuntu3cro all              Dummy package to get libc6:armhf installed
un  libc6-armhf-armhf-cross <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-armhf-cross       2.23-0ubuntu3cro all              GNU C Library: Shared libraries (for cross-compilin
un  libc6-armhf-dcv1        <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-dbg:amd64         2.23-0ubuntu4    amd64            GNU C Library: detached debugging symbols
ii  libc6-dbg-armel-cross   2.23-0ubuntu3cro all              GNU C Library: detached debugging symbols (for cros
un  libc6-dbg-armel-dcv1    <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-dev:amd64         2.23-0ubuntu4    amd64            GNU C Library: Development Libraries and Header Fil
un  libc6-dev-armel-armel-c <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-dev-armel-armhf-c 2.23-0ubuntu3cro all              Dummy package to get libc6-dev:armel installed
ii  libc6-dev-armel-cross   2.23-0ubuntu3cro all              GNU C Library: Development Libraries and Header Fil
un  libc6-dev-armel-dcv1    <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-dev-armhf-armel-c 2.23-0ubuntu3cro all              Dummy package to get libc6-dev:armhf installed
un  libc6-dev-armhf-armhf-c <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-dev-armhf-cross   2.23-0ubuntu3cro all              GNU C Library: Development Libraries and Header Fil
un  libc6-dev-armhf-dcv1    <aucune>         <aucune>         (aucune description n'est disponible)
un  libc6-dev-i386          <aucune>         <aucune>         (aucune description n'est disponible)
ii  libc6-i386              2.23-0ubuntu4    amd64            GNU C Library: 32-bit shared libraries for AMD64
un  libc6-i686              <aucune>         <aucune>         (aucune description n'est disponible)
un  libc6-xen               <aucune>         <aucune>         (aucune description n'est disponible)
un  libc6.1                 <aucune>         <aucune>         (aucune description n'est disponible)
un  libc6.1-dev             <aucune>         <aucune>         (aucune description n'est disponible)
un  libc6.1-dev-armel-cross <aucune>         <aucune>         (aucune description n'est disponible)
un  libc6.1-dev-armhf-cross <aucune>         <aucune>         (aucune description n'est disponible)

Most of those packages but libc6-armel-cross are probably useless... Actually dpkg -L libc6-armel-cross shows /usr/arm-linux-gnueabi/lib/libc.so.6. However, libusb, libusb-dev installs still fail, and libphidget's configure also.

1 Answer 1

4

Multiarch only works if you stay in the same distribution, because the installed libraries have to match exactly. This is why you can't install the Precise libusb on your non-Precise system: it needs libc6:armel, but that can't match the native libc6 you have installed...

As I see it you have two "clean" solutions:

  • use multiarch on a distribution where armel is still supported (cough Debian cough);
  • cross-build libusb for armel yourself, using the armel cross-toolchain that's packaged in Ubuntu (which is what you've found with libc6-armel-cross etc.).

Alternatively you could copy the target libraries from the target system and point your build at those. You should get away with using your system's headers for libusb (but not for libc6).

2
  • I tried 2., but then I add to build udev, gobject, and a lot more I guess... I know it's gonna be horrible, but could I use a ldd on libusb on the target system, and copy the targeted libs from it?
    – luneart
    Commented Nov 21, 2016 at 16:38
  • 1
    Yes, that would work too! Commented Nov 21, 2016 at 16:50

You must log in to answer this question.

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