Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error: libudev.h: No such file or directory

I compile with g++/gcc on ubuntu12.04 and it is "OK" but I cannot cross compile using raspberry pi tools master

toolsmaster 
CC := /home/Desktop/Simple_Linux_Driver/tools-master/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-g++
GCC := /home/Desktop/Simple_Linux_Driver/tools-master/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-gcc

I had install the following item:

-sudo apt-get install libusb-1.0-0-dev
-sudo apt-get install libudev-dev

raspberry pi kernel version 3.2.27 (izzit I need to enable "how" and rebuilt again)?

like image 435
WenJuan Avatar asked Jul 23 '13 10:07

WenJuan


1 Answers

Its works!!! i need to cross compile and cp .h .so inside raspberry pi cross toolsmaster Below is what i try: Do let me know if i miss out anythings Thanks^^ download libusb latest version tar file.

version 1.0.8

$ TOOLCHAIN=/opt/FriendlyArm/toolchain/4.4.3/arm-none-linux-gnueabi
$ PATH=$PATH:$TOOLCHAIN/bin
$ CC='arm-none-linux-gnueabi-gcc -march=armv4t -mtune=arm920t'
$ CROSS_COMPILE=arm-none-linux-gnueabi-
$ export CC CROSS_COMPILE
$ tar xfv libusb-1.0.8.tar
$ cd libusb-1.0.8
$ ./configure --host arm-linux
$ make
$ cd libusb
$ cp libusb.h $TOOLCHAIN/arm-none-linux-gnueabi/include/
$ cp libusb.h $TOOLCHAIN/arm-none-linux-gnueabi/sysroot/include/
$ cp .libs/libusb-1.0.so $TOOLCHAIN/arm-none-linux-gnueabi/lib/
$ cp .libs/libusb-1.0.so $TOOLCHAIN/arm-none-linux-gnueabi/sysroot/lib/

THE TOOLCHAIN IS SET. for writing programs: add #include to use he library. compile using following:

$arm-linux-g++ myprog.cpp -o myapp -lusb-1.0

NOTE: DON'T MISSOUT ON "-lusb-1.0"

like image 186
WenJuan Avatar answered Oct 12 '22 09:10

WenJuan