Julie96
Julie96

Reputation: 361

Cross Compile Phidget library arm

I'm trying to cross compile some C code in order to execute it on a Phidget SBS4 - 3003. I already succeed to cross compile a simple .C file (printf("hello world");) and execute it on the SBC using arm-linux-gnueabihf-gcc toolchain for the cross compilation.

Now I'm struggling to cross compile a code using the phidget library. I'm trying to ./configure --prefix=/usr/arm-linux-gnueabihf --build=i686-pc-linux-gnu --host=arm-linux-gnueabihf as seen here, but i get an error :

configure: error: Missing libusb! I already installed libusb-1.0-0-dev.

What should I do ? Thanks a lot !

Upvotes: 0

Views: 382

Answers (1)

yflelion
yflelion

Reputation: 1746

There are two possibilities. The first one is a libusb compilation problem. Do you really have arm-none-linux-gnueabihf and arm-linux-gnueabihf in your machine? If you don't have the first one and build libusb with --host=arm-none-linux-gnueabihf. As strange as it can be, you will build an x86 library. you can check with readelf -h or any other tool you want if the library you build is really for arm.

The second possibility is the library location, you chose /usr/arm-linux-gnueabihf/ as prefix but how are you sure /usr/arm-linux-gnueabihf/lib will be in the list of path gcc pass to linker ( in ubuntu 18.04 it is the case). you can verify by adding -v while you link a simple c file which folders are passed to the linker. you need to install libusb in one of these folder because unfortunately in the configure of the phidget library, there is no option like libusb_path. You can also modify the configure.

If you install the good version of libusb in a folder specific to arm , you will not have any problems. However, if you install x86 library in arm folders or vice versa you will have ld error file format not recognized.

Upvotes: 1

Related Questions