Question

I'm trying to compile a tool that uses libusb with modified libusb for android. Modified libusb was compiled and installed to /usr/local/lib as expected. The problem is that standalone toolchain already contains libusb and it hurts linking/compilation.

./configure

Returns:

...
checking for usb_get_string_simple in -lusb... yes
...

So libusb if found okay.

But with standalone toolchain:

export CROSS_COMPILE=arm-linux-androideabi
export CC=${CROSS_COMPILE}-gcc
export CXX=${CROSS_COMPILE}=g++
export NDK=/softdev/android-ndk-r8e
export ANDROID_NDK_ROOT=/softdev/android-ndk-r8e
export SYSROOT=$NDK/platforms/android-8/arch-arm
export PATH=/softdev/arm-toolchain/bin:$PATH:/softdev/android-ndk-r8e/platforms/android-8/arch-arm

./configure --build=x86-unknown-linux-gnu --host=arm-linux-androideabi --target=arm-linux-androideabi

It returns:

...
checking for usb_get_string_simple in -lusb... no
...

how to make it working with standalone toolchain? libusb-0.1 is used

Was it helpful?

Solution

Well, finally i was able to fix it.

  1. the tool configure.ac file was not written in account to using libusb-compat (but for only libusb-0.1).

So i solved it by adding dependency while searching libusb-0.1 (-lusb-1.0):

AC_CHECK_LIB([usb], [usb_get_string_simple], [have_libusb=yes], [], [-lusb-1.0])

2. Another problem was to make AC_CHECK find libs not in standard system /usr/local/lib folder as modified library interface was a bit different and it tried to gcc with system one while searching with AC_CHECK_LIB. I used CPPFLAGS to set the right libs path

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top