Setting up the cross compiling environment in Ubuntu

Hi all,

I'm stuck with how to get cross compiling environment running for
beagle board on Ubuntu Linux.
I've been using Linux for few years already, so I'm fairly familiar
with working in the OS, but never really used it for any "serious
development". (I have only made c++/Qt programs, but setting that up
was just matter of apt-get...)

Thus, I'm completely lost what I should do to get cross compiling
environment running for Beagleboard/Angstrom.
My BB is running Ansgrom from SD card that came with the device, and I
can login to the OS ok via serial port.
Can you provide simple instructions and necessary information in
general to cross compiling ?

I tried following instructions in http://www.angstrom-distribution.org/building-angstrom
and have cloned the setup scripts, and executed
"./oebb.sh machine beagleboard" and "./oebb.sh update" - but after
this I don't understand what I should do.
Am I correct in assuming that I just downloaded the kernel sources,
and configured them to beagleboard ? What should I do now ? Compile
another Angstrom kernel, and replace the one in the SD card currently?

At what point should I set some environment variables defining that g+
+ should compile for ARM ?

Thanks a lot!

These are the steps that I used to set up cross compiling (It also has getting Eclipse and QT for the sake of completeness. Also I have wholesale copied instructions from various websites that showed how to do some of the individual bits. I apologize for not properly attributing these, but I originally wrote this list for my own memory and have since forgotten where I borrowed from.):

  1. Load Eclipse using the Applications->Ubuntu Software Center application.
  2. In the search box type eclipse
  3. Select the Eclipse IDE item from the list
  4. Press the “Install” button
  5. Open Eclipse (by typing eclipse at the command line)
  6. Ensure the C/C++ development tools are part of Eclipse

i. Select the “Help->About Eclipse SDK” menu option

ii. The About dialog displays icons representing all plugins which are part of Eclipse.

  1. If “Eclipse CDT” is not one of the icons, install it

i. Select the “Help->Install New Software…” menu option

ii. Select “Work with: All Available Sites” from the site list near the top of the dialog

iii. Select “Programming Tools->Eclipse C/C++ Development Tools” from the software list.

iv. Follow the dialog steps to install the tools.

  1. Load QT using the Applications->Ubuntu Software Center application
  2. Select the “Developer Tools” item from the Departments list
  3. In the search box type QT
  4. Select the QT 4 Designer item and press the “Install” button.
  5. Optionally, select the QT 4 Assistant item and press the “Install” button1. Download the QT Eclipse Integration for C++ package from http://qt.nokia.com/developer/eclipse-integration/
  6. Use the Linux x86 32bit version.
  7. Find the eclipse/plugins directory, likely /usr/lib/eclipse/plugins
  8. Change to the base directory, e.g. /usr/lib and extract the package:

i. cd /usr/lib

ii. sudo tar xzf ~/Downloads/qt-eclipse-integration-linux-x86-<version>.tar.gz

  1. Start a clean configuration of Eclipse:

i. eclipse –clean

ii. Exit eclipse

  1. Extract the cross-compiler
  2. Get one of the pre-made toolchains from Angstrom (http://www.angstrom-distribution.org/toolchains/) or build your own toolchain.
  3. Extract the cross-compiler

i. cd /

ii. sudo tar –xjvf pathname/to/your/Angstrom/toolchain/tarball

  1. Set up a cross-compiled “Hello World” program:
  2. Run eclipse
  3. Create a “New C Project”

i. File->New->C Project

  1. Call the project “HelloBeagle”
  2. Select “Hello World ANSI C Project”
  3. Select “Finish”
  4. Right-click on the “HelloBeagle” project folder and create a new Build Configuration:

i. Build Configurations->Manage…

ii. Select “New”

iii. Set the Name: to BeagleBoardRelease

iv. Set the Existing configuration to “Release”

v. Press “OK” and “OK” to leave the dialog

  1. Right-click on the “HelloBeagle” project folder and set the properties of the cross-compiled target:

i. Select Properties

ii. Select C/C++ Build->Settings

iii. Reset the GCC C Compiler “Command:” to

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc

iv. Add the following include path to the “Directories”

/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include

v. Reset the GCC C Linker “Command:” to

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc

vi. Add the following library path to the “Libraries”

/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/lib

vii. Reset the GCC Assembler “Command:” to

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-as

  1. Set the active target to BeagleBoardRelease

i. Right-click on the “HelloBeagle” project folder

ii. Select “Build Configurations->Set Active->BeagleBoardRelease”

  1. Right-click on the “HelloBeagle” project and select “Build Project”
  2. If you copy the resulting executable to a Beagleboard running Angstrom, the executable will perform as expected. (at least on my machine.)

I hope this helps.

Derek

Follow the rest of that guide, you stopped halfway step 2

Hi Derek,

Thank you so much, my server app is now running on the BB.
This was exactly the type of clear instructions needed for newbies!
It indeed turns out to be quite simple, once you give up trying to
compile in command line :wink:

Btw. only one issue was with the linker's library path, at least I had
to use "library search path" (-L) instead "library" (-l)

Juha