Jessie armhf Cross Compile

From embeddedTS Manuals
Revision as of 11:06, 28 August 2015 by Mark (talk | contribs) (Created page with "# Run "lsb_release -a" and verify Debian 8.X is returned. These instructions are not # expected to work on any other version or distribution. apt-get install curl build-esse...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  1. Run "lsb_release -a" and verify Debian 8.X is returned. These instructions are not
  2. expected to work on any other version or distribution.

apt-get install curl build-essential

su root echo "deb http://emdebian.org/tools/debian jessie main" > /etc/apt/sources.list.d/emdebian.list curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - dpkg --add-architecture armhf apt-get update apt-get install crossbuild-essential-armhf

  1. This will install a toolchain you can use with the prefix:
  2. "arm-linux-gnueabihf-"
  3. eg, arm-linux-gnueabihf-gcc, arm-linux-gnueabihf-g++, etc
  4. You can test out thet toolchain with a hello world. Create your hello-world.c with your preferred editor

vim hello-world.c arm-linux-gnueabihf-gcc hello-world.c -o hello-world file hello-world

  1. This will return that the binary created is for ARM. Copy this to the armhf distribution to run it there
  1. Now to link to a shared library from the Debian environment. Make sure this
  2. is installed on both your x86 system, and the board.

apt-get install libcurl4-openssl-dev:armhf

  1. Download the simple.c example from curl:

wget https://raw.githubusercontent.com/bagder/curl/master/docs/examples/simple.c

  1. After installing the supporting library, curl will link just as compiling on the unit.

arm-linux-gnueabihf-gcc simple.c -o simple -lcurl