I am trying to compile my USB driver codes using openwrt-gcc. I could not find a way how to build a program using external libraries (libusb). Here is how I did, and errors I got.
alias for openwrt_gcc
- Code: Select all
alias openwrt_gcc='/home/cloe/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc'
I found the libusb flag using this command.
- Code: Select all
pkg-config --libs libusb
- Code: Select all
cloe@spike:~/src/vocoreUSBdriver$ openwrt_gcc -g main.c -o -lusb-1.0 vocoreUSBdriver
mipsel-openwrt-linux-gcc: error: vocoreUSBdriver: No such file or directory
cloe@spike:~/src/vocoreUSBdriver$ openwrt_gcc -o main main.c -lusb-1.0
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/home/cloe/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: cannot find -lusb-1.0
collect2: error: ld returned 1 exit status
- Code: Select all
cloe@spike:~/src/vocoreUSBdriver$ openwrt_gcc -o main main.c -lusb
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/home/cloe/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: cannot find -lusb
collect2: error: ld returned 1 exit status
Please let me know if you have an answer for this!
Thank you