-1

Steps I followed to cross compile the libusb-1.0.9 to use with already cross compiled QT5 for raspberry pi3. I have the libusb1.0.9 folder located at /home/yasir/Development/crosscompile/libususb-1.0.9

mounted image of raspberry pi3 at /mnt/rasp-pi-rootfs/

STEPS

step 1.

At /home/yasir/Development/crosscompile I run this

./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ /home/yasir/Development/crosscompile/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc

step 2.

Then I go to /home/yasir/Development/crosscompile/libususb-1.0.9 I run this

./configure --host=arm-linux --prefix=/usr/local/libusb-rpi  -disable-udev --with-sysroot=/mnt/rasp-pi-rootfs/  CROSS_COMPILE=/home/yasir/Development/crosscompile/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- CFLAGS=-I/mnt/rasp-pi-rootfs/usr/include/ /mnt/rasp-pi-rootfs/usr/local/include/ LIBS=-L/mnt/rasp-pi-rootfs/usr/lib

please note this in the mean of terminal output: enter image description here

step 3

sudo make

step 4

sudo make install

.so file generated

step no 5

make install does copy files to /usr/local/libusb-rpi on the PC, but not to the image mounted. So I did this

sudo mkdir -p /mnt/rasp-pi-rootfs/usr/local/libusb-rpi
sudo rsync -avh /usr/local/libusb-rpi/  /mnt/rasp-pi-rootfs/usr/local/libusb-rpi/

but QT5 compiler claims that the libusb-1.0.so has wrong format when I did this

object dump  -f libusb-1.0.so 

which clearly shows that the libusb -1.0.so file is generated but not for the raspberry pi arm architecture its for the host system.

Please tell me where I am wrong. Why libusb-1.0.so file is not cross compiled for the arm architecture(raspberry pi3), while I have use all the correct tools for the cross compilation.

please advice so I can generate .so file for the rapberry pi3 through cross compilation, though I also investigated the generated libusb.so file at the raspberry pi3 itself ,it was found to small size and its architecture was also arm.

Cœur
  • 37,241
  • 25
  • 195
  • 267
yasirateeq857
  • 19
  • 1
  • 6

1 Answers1

1

I used below script for configure and then a correct libusb-1.0.so file is generated whose architecture was for arm(raspberry pi3).

./configure CC=/home/yasir/Development/crosscompile/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc  --host=arm-linux --enable-udev=no --enable-shared  --prefix=/usr/local/libusb-rpi
Blue
  • 22,608
  • 7
  • 62
  • 92
yasirateeq857
  • 19
  • 1
  • 6