OpenWrt Forum Archive

Topic: Need libusb for omnima board

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am producing an application for the Omnima board using KDevelop running under Slackware.

My current problem is it can't find <usb.h>

I think it expects it under /home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2/include

I don't fully understand the details of the environment.

I have install libusb because a few posts said usb.h is in that.

However it seems to have put it in /home/developer/squidge/openwrt/staging_dir/mipsel/usr/include

Any ideas ?

Thanks
Jim

(Last edited by prioryjim on 30 May 2009, 06:21)

Include the /home/developer/squidge/openwrt/staging_dir/mipsel/usr/include directory with -I option to your makefile and use it.
Another solution is to copy entire /home/developer/squidge/openwrt/staging_dir/mipsel/usr/include to /home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2/include

In /home/developer/squidge/openwrt
I tried to use make menuconfig, didn't change anything but it had a "M" next to libusb
So saved config and exited. Prompt said type "make" so I did

bash-3.1$ strace -o jims.log make
++ mkdir -p /home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2
++ cd /home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2
++ mkdir -p bin lib include stamp
Checking 'bison'... ok.
make[1] world
make[2] target/compile
make[3] -C target/linux compile

Then it just hangs, left it for a full day but no action.
As you can see above I ran it with strace so I do have a system trace.

Anyone ideas on why make won't make ?
Thanks

I am still trying to use libusb under KDevelop


I have found libusb.so that appears to be cross compiled, it is in /home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib
I used 'file' to check thus ...
bash-3.1$ file libusb.so
libusb.so: ELF 32-bit LSB shared object, MIPS, version 1 (SYSV), not stripped
I assume MIPS is the target processor.


But when I make it under KDeveloper I getsome strange messages

In project/project option/configure option
Linker Flags: (LDFLAGS)
I have set the following
-L/home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib

Then I get ...
cd '/home/developer/Pencam/./' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" LC_MESSAGES="C" LC_CTYPE="C" gmake Pencam
linking Pencam (libtool)
mkdir .libs
linking Pencam (gcc)
/usr/lib/libusb.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
gmake: *** [Pencam] Error 1
*** Exited with status: 2 ***

However if I set -L /home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib
Note the space after -L , I get ...
cd '/home/developer/Pencam/./' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" LC_MESSAGES="C" LC_CTYPE="C" gmake Pencam
linking Pencam (libtool)
mkdir .libs
linking Pencam (gcc)
/home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2/mipsel-linux-uclibc/bin/../lib/gcc/mipsel-linux-uclibc/4.1.2/../../../../mipsel-linux-uclibc/bin/ld: /home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib: No such file: File format not recognized
collect2: ld returned 1 exit status
gmake: *** [Pencam] Error 1
*** Exited with status: 2 ***

Now obviously /usr/lib/libusb.so is wrong as it will be the hosts file format.
But don;t seem to be able to get it to include the correct libusb.so

Any ideas
Thanks
Jim

Spent another evening trying all conceivable options but can't get past the error below e.g. "No such file: File format not recognized"
I know ( I think I know ) that libusb.so is in that directory and is the correct format.
But about to give up unless anyone has any ideas.

make  all-am
make[1]: Entering directory `/home/developer/Pencam'
/bin/sh ./libtool --tag=CC --mode=link /home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2/mipsel-linux-uclibc/bin/gcc  -g -O2  -L /home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib -o Pencam --build=mipsel bayer.o pencam2-misc.o pencam2.o pensnap2.o saturate.o sharpen.o unsharp.o -lusb
mkdir .libs
/home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2/mipsel-linux-uclibc/bin/gcc -g -O2 /home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib -o Pencam --build=mipsel bayer.o pencam2-misc.o pencam2.o pensnap2.o saturate.o sharpen.o unsharp.o  -L/home/developer/Pencam -lusb
/home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2/mipsel-linux-uclibc/bin/../lib/gcc/mipsel-linux-uclibc/4.1.2/../../../../mipsel-linux-uclibc/bin/ld: /home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib: No such file: File format not recognized
collect2: ld returned 1 exit status
make[1]: *** [Pencam] Error 1
make[1]: Leaving directory `/home/developer/Pencam'
make: *** [all] Error 2

Fixed it (bodged)
Now as before my libusb.so was in
/home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib

And -L /home/developer/squidge/openwrt/staging_dir/mipsel/usr/lib
Caused strange error.

So I located the standard lib path using ..

Project/Project Options/Make Option
Then the  Environment button
And located LIB which was
/home/developer/squidge/openwrt/staging_dir/toolchain-mipsel_gcc4.1.2/mipsel-linux-uclibc/lib

Strangly you can't copy the text from the window, most annoying!

So I copied the libusb.so to this location and the application build no problem.
Transferred it to my Omnima board and it ran OK.
Well it ran, but I still have work to do on the application.

Phew that took a while and still not sure why, perhaps a linker bug ?

Jim

The discussion might have continued from here.