What is the standalone toolchain?
Asked Answered
A

2

15

I am trying to understand what a standalone toolchain means. Following are my findings. A toolchain which is ready to use with all the configuration that is the system headers and libraries in the correct path . For Android it will also have the API headers in the path where the toolchain can look it up. Why the term "standalone"? This probably will be different that the regular toolchain in the sense that the R T will need to be configured and made ready for android use withe sysroot and libc header paths given etc. Please comment .

Hmm, I was compiling for android and one process was running a script called make-standalone-toolchain.sh a standalone toolchain is created .I was going through this script to understand what this is doing. Not really good at shell scripting. But made out certain things. ""Generate a customized Android toolchain installation that includes a working sysroot. The result is something that can more easily be used as a standalone cross-compiler, e.g. to run configure and make scripts." --toolchain arch ndk-dir package-dir system platform variables are set Compute source sysroot SRC_SYSROOT="$NDK_DIR/platforms/$PLATFORM arch-$ARCH" Copying sysroot headers and libraries... libstdc++ headers and libraries... prebuilt binaries.all into a temporary folder then a copying from Tmp dir to install dir creating a tar ie a package file to add the tmpdir wanted to know what exactly is happening here or a link or suggestion where to look.but ofcourse dont want to read very elaborate manuals. ~

Armorial answered 6/11, 2012 at 8:33 Comment(2)
please provide some information as to what you have tried, what you are aiming for, the question seems to broad at the moment.Polytheism
This answer has a great example of how to use it: https://mcmap.net/q/402647/-want-to-compile-native-android-binary-i-can-run-in-terminal-on-the-phoneEllissa
G
8

This blog posting may answer your question:

http://clseto.mysinablog.com/index.php?op=ViewArticle&articleId=3480794

There is a recommended way to build native C/C++ program on Android: List your source files in a script (Android.mk) and run 'ndk-build'. It may not be a problem if you are writing new programs but if you already have a working build script (like those open source softwares) which can build you program nicely on Linux, it would be a headache to migrate your script to Android.mk. All you need in this situation is a C/C++ cross compiler and then replace the variables in your script (such as CC, CXX, AR, AS, RANLIB, ...) to something like 'arm-linux-androideabi-gcc', 'arm-linux-androideabi-g++', ...

Fortunatley, inside the 'Android NDK Dev Guide', there is a section 'Standalone Toolchain' which just describes what we need....

Godgiven answered 2/5, 2013 at 21:16 Comment(1)
Blogpost and blog has gone, If you want webarchive link: web.archive.org/web/20130128135104/http://…Rockefeller
J
0

First of all, the best guide for stand alone toolchains in Android is here: https://developer.android.com/ndk/guides/standalone_toolchain. I have used it several times for different devices and platform.

You need to download NDK and then run the script 'make-standalone-toolchain.sh' with a few parameters (as said in the link above) that will determine the API levels of your apps, the architecture of the device etc.

The output of the script will be a directory that you can use as a toolchain in order to cross compile native C/C++ code to run on Android devices. You need to put in your Makefile the path to the toolchain directory and add the architecture suffix for the binaries inside (for example 'arm-eabi-'). Something like:

CROSS_COMPILE = /path-to-toolchain-dir/bin/arm-eabi-

There should be files like '/path-to-toolchain-dir/bin/arm-eabi-gcc' in your toolchain directory.

Anyway, this will tell the Makefile to use your toolchain's binaries in order to compile the C/C++ native code and create the compatible executables for your target machine.

For example, this is the commands I used to create a stand alone tool chain for a certaion Android device:

./make-standalone-toolchain.shj --arch=arm --platform=android-21 --install-dir=<dest-dir> --toolchain=arm-linux-androideabi-4.9
Jolty answered 28/8, 2018 at 12:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.