15

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)?

brasofilo
  • 25,496
  • 15
  • 91
  • 179
WenJuan
  • 624
  • 1
  • 8
  • 21

2 Answers2

3

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"

WenJuan
  • 624
  • 1
  • 8
  • 21
0

If you do above it will install libraries that is for x86. The above libraries should be in raspberry cross-tool chain. if its not present then you need cross-compile it for arm architecture. Then you have to export it by follwing cmd

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path to library

First export the tools using export command.

export PATH=$PATH:/path to tool chain

Before doing above 1st try the following

e.g export PATH=$PATH:/home/Desktop/Simple_Linux_Driver/tools-master/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/

if you want to export it everytime in every terminal then .

vi .bashrc

At the end of file just add below command .

export PATH=/path to tool chain bin:$PATH

e.g export PATH=/opt/Arm_tool_chain/bin:$PATH

vinay hunachyal
  • 3,781
  • 2
  • 20
  • 31
  • first what you are trying to compile.2)where you are compiling in x86 or raspberry board? – vinay hunachyal Jul 24 '13 at 06:42
  • i am trying to compile a USB driver code i get from github (https://github.com/signal11/hidapi). i using x86 to compile the code. – WenJuan Jul 30 '13 at 05:48
  • Can you share your Makefile. so that i can figure out what exactly you trying – vinay hunachyal Jul 30 '13 at 06:19
  • can i send through your email? i had try cross compile with libusb using raspberry pi toolmaster and it is works but i not yet try on the libudev yet. – WenJuan Jul 30 '13 at 08:58
  • Ok send me with little bit explanation what you trying to do.In above comment its not clear what you are saying . here is my id vinayhunachyal@gmail.com – vinay hunachyal Jul 30 '13 at 09:03