Android : Cross compile for NDK with Standalone_toolchain

Hello All members

I’d like to do compile “ROOT” with Android Native Development kit ( NDK ).
Today, I tried for 8 hours… but I could not finish it…
There is lot of unknown errors…
My knowledge is not enough for cross compile on Windows.

[Useful file]
First, I found this file
It’s look like useful.

[Cross Compile environment]
next, I made Cross compiler on windows.
This article was very useful.

with this command,
Now, I got arm-linux-androideabi-gcc,g++,ld.exe… and lot of files.
Android Studio give us cross compile environment.
$NDK/build/tools/make-standalone-toolchain.sh --force --arch=arm --platform=android-23 --install-dir=/d/local/MyDevelop/Android/library/standalone_toolchain

and first useful file ( Android.cmake ) has short usage.
I tried… but not work at all.

Usage:
mkdir build; cd build
cmake …; make
mkdir android; cd android
cmake -DLLVM_ANDROID_TOOLCHAIN_DIR=/path/to/android/ndk
-DCMAKE_TOOLCHAIN_FILE=…/…/cmake/platforms/Android.cmake …/…
make

Could you help , advice me a bit ?
I tried 8 hours … but No progressssss… : (

Hi. Can you please put us on context. What are you trying to do and why?

Thank you, Mato.

Here is my step.
First, here is manual from the file “Android.cmake”

mkdir build; cd build
cmake …; make
mkdir android; cd android
cmake -DLLVM_ANDROID_TOOLCHAIN_DIR=/path/to/android/ndk
-DCMAKE_TOOLCHAIN_FILE=…/…/cmake/platforms/Android.cmake …/…
make

(1) Download ROOT tar.gz package and extract to a Windows folder.
(2) mkdir build --> mkdir: cannot create directory ‘build’: File exists, ok, do not mind.
(3) cd build —> success
(4) cmake …; make

– Building for: Visual Studio 14 2015
– The C compiler identification is unknown
– The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (project):
No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:5 (project):
No CMAKE_CXX_COMPILER could be found.

– Configuring incomplete, errors occurred!
See also “D:/local/MyDevelop/Android/tmp/root-6.04.18/build/CMakeFiles/CMakeOutput.log”.
See also “D:/local/MyDevelop/Android/tmp/root-6.04.18/build/CMakeFiles/CMakeError.log”.

errors… why ?
ok, let’s ignore it …

(5)mkdir android --> success
(6)cd android --> success
(7)cmake -DLLVM_ANDROID_TOOLCHAIN_DIR=/path/to/android/ndk -DCMAKE_TOOLCHAIN_FILE=…/…/cmake/platforms/Android.cmake …/…
—> Error…

– Building for: Visual Studio 14 2015
CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeDetermineSystem.cmake:94 (message):
Could not find toolchain file: …/…/cmake/platforms/Android.cmake
Call Stack (most recent call first):
CMakeLists.txt:5 (project)

– Configuring incomplete, errors occurred!

… I can not do same with manual.

Can you help it ?

Sorry, still I do not see what you are trying to achieve. What is the goal? What are you trying to do? I see that you want to build ROOT on Windows. ROOT 6 is not yet supported for windows.

I want to run this library on Android tablet.
Android is one of linux machine.
Android development langage is Java.
I want to call ROOT library from Java-NDK( Native Development Kit ).
Java can call C++ functions.
This is goal.

but My PC is windows,
Android Studio is running on my Windows 10 machine.
first, I want to compile ROOT library(C++) with Linux-ARM compiler on windows machine.
it make ARM ELF 32 binary on windows.

Could you advice me ?

Kazu

I would not say it is impossible because in software everything is possible, but it is really very very hard. We had a project to run ROOT on iOS (iPad tablets) but we abandoned it due to many many problems. Just coross-building on a Windows for Android has never been tried before and probably it is by itself a huge project. Then running ROOT in Android is yet another uncharted territory.

The alternative is not to build ROOT for tablets. We recommend to use the web interface and connect to a remote ROOT session from the tablet. We have done this with the SWAN service at CER (see https://swan.web.cern.ch). Alternatively you can also start ROOT jupyter notebooks with just typing $ root --notebook.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.