Skip to content

Instantly share code, notes, and snippets.

@ksutcr18
ksutcr18 / gist:f24c7ffe6f0547a6ae3ccdd262661f93
Created January 6, 2018 03:38 — forked from craigminihan/gist:2a169c0ef3550b078e46
Build GCC 4.9.3 on a Raspberry Pi 2b running Raspian 2015-05-05
sudo apt-get install libmpc-dev
sudo apt-get install libmpfr-dev
sudo apt-get install libgmp-dev
export LDFLAGS='-L/usr/lib/arm-linux-gnueabihf/ -L/usr/lib/gcc/arm-linux-gnueabihf/4.6/'
export CFLAGS='-I/usr/include/arm-linux-gnueabihf/ -mfloat-abi=hard '${LDFLAGS}
export CXXFLAGS=${CFLAGS}
export CPPFLAGS=${CFLAGS}
sudo ln -s /usr/lib/arm-linux-gnueabihf/crti.o /usr/lib
@ksutcr18
ksutcr18 / install-gcc-4.9.3.sh
Created January 5, 2018 04:38 — forked from jtilly/install-gcc-4.9.3.sh
Install GCC 4.9.3
#!/bin/bash
# this script installs GCC 4.9.3
# to use it navigate to your home directory and type:
# sh install-gcc-4.9.3.sh
# download and install gcc 4.9.3
wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.3/gcc-4.9.3.tar.gz
tar xzf gcc-4.9.3.tar.gz
cd gcc-4.9.3
@ksutcr18
ksutcr18 / download-android-ndks-direct-links.sh
Created December 23, 2017 04:23 — forked from roscopecoltran/download-android-ndks-direct-links.sh
Download Android NDK Tools / Direct Links
@ksutcr18
ksutcr18 / howto-standalone-toolchain.md
Created December 6, 2017 16:11 — forked from Tydus/howto-standalone-toolchain.md
How to install Standalone toolchain for Android

HOWTO Cross compiling on Android

5W1H

What is NDK

NDK (Native Develop Toolkit) is a toolchain from Android official, originally for users who writes native C/C++ code as JNI library. It's not designed for compiling standalone programs (./a.out) and not compatible with automake/cmake etc.

What is Standalone Toolchain

"Standalone" refers to two meanings:

  1. The program is standalone (has nothing connect to NDK, and don't need helper scripts to run it)
  2. The toolchain is made for building standalone programs and libs, and which can used by automake etc.

(Optional) Why NDK is hard to use

By default, NDK uses android flavor directory structure when it's finding headers and libs, which is different from GNU flavor, so the compiler cannot find them. For Example: