Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

TBB 4.1 update 3 for Android

Riccardo_Ancona
Beginner
352 Views

Hi everyone,

I am having some difficulties in following the tutorial at http://software.intel.com/en-us/articles/android-tutorial-writing-a-multithreaded-application-using-intel-threading-building-blocks using TBB 4.1 update 3 source files and NDK r8e.

From the first rows, I noticed that there is no <unpacked_dir>/build/android_setup.csh script to be executed, I noticed that the compiling guidelines say that I have to build the library using ndk-build target=android, but I don't understand if the build is successful because there is a huge number of ignored errors like:

make[1]: [malloc_test_no_depends] Error 1 (ignored)
sh ../../build/android.linux.launcher.sh ./test_malloc_atexit.exe
/system/bin/sh: ./test_malloc_atexit.exe: not executable: magic 7F45

and at the end of the built I got:

/home/raa/Android/NDK/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86/bin/i686-linux-android-g++ -c -MMD -o test_malloc_lib_unload_dll.o -O2 -DUSE_PTHREAD -D_GLIBCXX_HAVE_FENV_H -DDO_ITT_NOTIFY -D__TBB_USE_DLOPEN_REENTRANCY_WORKAROUND=1 -D__TBB_USE_DLOPEN_MAIN_PROGRAM_WORKAROUND=1 --sysroot=/home/raa/Android/NDK/android-ndk-r8e/platforms/android-9/arch-x86 -m32 -Wall -fPIC -D_USRDLL -I../../src -I../../src/rml/include -I../../include ../../src/test/test_malloc_lib_unload.cpp
/home/raa/Android/NDK/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86/bin/i686-linux-android-g++ -fPIC -o test_malloc_lib_unload_dll.so -O2 -DUSE_PTHREAD -D_GLIBCXX_HAVE_FENV_H -DDO_ITT_NOTIFY -D__TBB_USE_DLOPEN_REENTRANCY_WORKAROUND=1 -D__TBB_USE_DLOPEN_MAIN_PROGRAM_WORKAROUND=1 --sysroot=/home/raa/Android/NDK/android-ndk-r8e/platforms/android-9/arch-x86 -m32 -Wall -fPIC test_malloc_lib_unload_dll.o -L/home/raa/Android/NDK/android-ndk-r8e/platforms/android-9/arch-x86/usr/lib -L/home/raa/Android/NDK/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86 -lgnustl_shared -ldl -Wl,-rpath-link=. -shared
/home/raa/Android/NDK/android-ndk-r8e/toolchains/x86-4.6/prebuilt/linux-x86/bin/i686-linux-android-g++ -o test_malloc_lib_unload.exe -O2 -DUSE_PTHREAD -D_GLIBCXX_HAVE_FENV_H -DDO_ITT_NOTIFY -D__TBB_USE_DLOPEN_REENTRANCY_WORKAROUND=1 -D__TBB_USE_DLOPEN_MAIN_PROGRAM_WORKAROUND=1 --sysroot=/home/raa/Android/NDK/android-ndk-r8e/platforms/android-9/arch-x86 -m32 -fno-rtti -fno-exceptions -fno-schedule-insns2 -D__TBBMALLOC_BUILD=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../src/test/test_malloc_lib_unload.cpp -L/home/raa/Android/NDK/android-ndk-r8e/platforms/android-9/arch-x86/usr/lib -L/home/raa/Android/NDK/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/x86 -lgnustl_shared test_malloc_lib_unload_dll.so -ldl -Wl,-rpath-link=.
sh ../../build/android.linux.launcher.sh ./test_malloc_pools.exe 1:4
/system/bin/sh: ./test_malloc_pools.exe: not executable: magic 7F45
make[1]: [malloc_test_no_depends] Error 1 (ignored)
sh ../../build/android.linux.launcher.sh ./test_malloc_atexit.exe
/system/bin/sh: ./test_malloc_atexit.exe: not executable: magic 7F45
make[1]: [malloc_test_no_depends] Error 1 (ignored)
sh ../../build/android.linux.launcher.sh test_malloc_lib_unload.exe
/system/bin/sh: ./test_malloc_lib_unload.exe: not executable: magic 7F45
make[1]: [malloc_test_no_depends] Error 1 (ignored)
sh ../../build/android.linux.launcher.sh -l libtbbmalloc_proxy.so test_malloc_overload.exe
^C../../build/android.linux.launcher.sh: 51: exit: Illegal number: -1
make[1]: [malloc_test_no_depends] Error 2 (ignored)
make: *** [tbbmalloc_test_release_no_depends] Interrupt

So, how can I compile TBB library for armeabi-v7a architecture?

 But most of all, where I can find  Android documentation for TBB? That tutorial is too old! Is there an updated tutorial for Android quickstart with TBB? 

0 Kudos
2 Replies
Vladimir_P_1234567890
352 Views

hello Riccardo,

You can find a sample to build app for android in parallel_for/tachyon example. Its android makefiles are aligned with NDK spec.

the command line to build the library is

[bash]
ndk-build target=android tbb
[/bash]

For armeabi-v7a 

[bash]
ndk-build target=android tbb arch=arm
[/bash]

--Vladimir

0 Kudos
Riccardo_Ancona
Beginner
352 Views

Thank you SO much :) Now all is working and I am running TBB on android!

Thanks a lot!

0 Kudos
Reply