Showing posts with label armhf. Show all posts
Showing posts with label armhf. Show all posts

Tuesday, August 5, 2014

Cross-compile GDB for ARM (ARMEL & ARMHF)

Let's say you have:
Machine A: x86, cross-compile for armhf
Machine B: armhf

On Machine A, you create a program. Then you copy the program to Machine B.
On Machine B, you execute the program and boom fatal error, a core is generated.

The question is: on which machine should I use GDB to read the core file?
Answer: Machine A! But you need to install GDB for ARMHF!

Here are the steps (on Machine A):

Download GDB
wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.gz
Extract
gunzip gdb-7.8.tar.gz
tar -xf gdb-7.8.tar
Go to the folder
cd gdb-7.8/
Build GDB 
#ARMHF
./configure --target=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf CXX="arm-linux-gnueabi-g++"
#ARMEL
./configure --target=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi CXX="arm-linux-gnueabi-g++"
make
make install
And that's it.
From Machine B, copy the core file in Machine A, and run this command:
/usr/arm-linux-gnueabihf/arm-linux-gnueabihf-gdb myProgram core

And that's it.


Note: I'm not sure if you really need to specify CXX when building GDB.

Wednesday, July 30, 2014

cross-compile ncurses for ARM: ARMEL & ARMHF

First, make sure you have installed these packages:

# ARMHF
sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install g++-arm-linux-gnueabihf
# ARMEL
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi
Make sure you did the following command and that "gcc" is in your path
sudo apt-get install build-essential

Download ncurses:
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

Extract ncurses:
tar -xzf ncurses-5.9.tar.gz

Go to the folder:
cd ncurses-5.9

And build ncurses:
#ARMEL
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi CXX="arm-linux-gnueabi-g++"
#ARMHF
./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf CXX="arm-linux-gnueabihf-g++"
make
sudo make install

 Done!

Then you should see libncurses.a with this command:
ls /usr/arm-linux-gnueabi/lib
ls /usr/arm-linux-gnueabihf/lib