Coder Social home page Coder Social logo

tate-san / crossarm Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24 KB

Simplified arm/aarch64 crosscompilation

License: Creative Commons Zero v1.0 Universal

Dockerfile 30.85% Shell 62.62% CMake 6.52%
aarch64 aarch64-linux aarch64-linux-toolchain arm arm-linux arm-linux-gnueabihf crosscompile toolchain

crossarm's Introduction

CrossArm

Just another crosscompiling tool for arm/aarch64 GNU/Linux.

The aim of this project was to make crosscompiling as simple as possible.

The docker image is using Debian:latest.

Toolchains

  • Arm 7.1
  • Aarch64 10.3

Installing

You can easily install CrossArm using the build script

You must run the install script as root

./install.sh (Default architecture is arm)

For list of arguments use the help argument

./install.sh -h

The script builds a docker ubuntu image with the selected architecture toolchain.

Script for running the crosscompiling environment is installed in /usr/bin.
The name of the script is crossarm-{architecture} eg. crossarm-arm, crossarm-aarch64.

Uninstall

To uninstall use ./install.sh -u. (Keeps the chroot directory /opt/crossarm-{architecture})
For complete uninstall use ./install.sh -u -p

Usage

To open current directory in the crosscompile environment just run the crossarm-{architecture} script.
If you want to open a different directory in the environment run crossarm-{architecture} /path/to/dir.

The whole toolchain /toolchain is added in the PATH variable for more convenient usage.

To not lose the installed libraries, a folder /cross-chroot has been added, the folder is shared with the host in /opt/crossarm-{architecture}.
Therefore whenever you want to install a library and preserve it, use prefix /cross-chroot.

Examples

I will be using aarch64 for these examples.

Building simple C/C++ program

File main.c

#include <stdio.h>

int main() {
    printf("Hello arm\n");
    return 0;
}

Enter the environent crossarm-aarch64
Now you can build it using aarch64-none-linux-gnu-gcc main.c -o main
And viola

❯ file main
main: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, with debug_info, not stripped

Building using CMake

For CMake nothing much changes. You just need to add the toolchain into your CMakeFile which is located in /opt/toolchain.cmake

set(CMAKE_TOOLCHAIN_FILE /opt/toolchain.cmake)

TODO

  • Run the commands using oneliner without entering the docker

crossarm's People

Contributors

tate-san avatar

Watchers

 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.