Click here to Skip to main content
15,879,844 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I compile with g++/gcc on ubuntu12.04 and it is "OK" but I cannot cross compile using raspberry pi tools master

toolsmaster
VB
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
C#
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/include/libudev.h
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/include/libusb-1.0/libusb.h


raspberry pi kernel version 3.2.27

Any suggection or i miss out something?
Posted

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"
 
Share this answer
 
LD_LIBRARY_PATH is used by the linker not the compiler, and even then you should only add the path as far as the directory containing the required files. See http://stackoverflow.com/questions/558803/how-to-add-a-default-include-path-for-gcc-in-linux[^] for setting the path for include files.
 
Share this answer
 
Comments
H.Brydon 31-Jul-13 21:38pm    
Great answer, +5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900