Giter VIP home page Giter VIP logo

pi-cross-compile-old's Introduction

mitchallen/pi-cross-compile (Dockerfile)

A Dockerfile to allow cross-compiling C/C++ projects in Ubuntu that will run on a Raspberry Pi.


Usage

Note that these instructions were written for a Mac.

To use this container you must pass it a local path that contains a Makefile and a project to compile. In the example below, substitute ~/MY-PROJECTS/MY-BUILD with a path to your local project. Your folder must contain a valid make file called Makefile. The make file must contain references to the Raspberry Pi specific tools that will be described below.

docker run -it -v ~/MY-PROJECTS/MY-BUILD:/build mitchallen/pi-cross-compile

Example

If you had a root project folder called ~/raspberry and a child folder containing your make file and source code called hello you would compile it for Raspberry Pi like this:

docker run -it -v ~/raspberry/hello:/build mitchallen/pi-cross-compile

During the build process, output should be displayed in the terminal. On success, the container will exit and an executable that works on the Pi should be left in your local build directory.

You can find an example project here:

To use the example project do the following:

mkdir ~/raspberry

cd ~/raspberry

git clone https://github.com/mitchallen/pi-hello-cross-compile.git --depth=1 hello

docker run -it -v ~/raspberry/hello:/build mitchallen/pi-cross-compile

On success an executable that only runs on the Raspberry Pi should be found here: ~/raspberry/hello/bin/hello. It's up to you to figure out how to get it on your Pi to run it.


Tools

This image contains a call to download Raspberry Cross Compile tools that can be found here: https://github.com/raspberrypi/tools.git. It places them in a folder called pitools.

The actual line is this:

git clone --progress --verbose https://github.com/raspberrypi/tools.git --depth=1 pitools

To cross compile using gcc for Raspberry Pi you would need a line like this in your Makefile:

CC=/pitools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc

For other tools in that folder, browse here.


Running on Pi

Once your build is complete, the executable will not work on Ubuntu or a Mac. It will be up to you to copy it over to your Pi and test it.


Repo(s)


Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.


Version History

Version 0.1.3 release notes

  • Added cd command to example usage

Version 0.1.2 release notes

  • Added links to example and added usage details

Version 0.1.1 release notes

  • Fixed type-o in README

Version 0.1.0 release notes

  • Initial release

pi-cross-compile-old's People

Contributors

benjymous avatar joshuacox avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.