[Compiling Error] tbb_allocator.h has errors.

[Compiling Error] tbb_allocator.h has errors.

Hi, Sirs, I met problems when compiling NDK within TBB over MAC platform.

May I ask you give me some advices?  I want to know the root causes very much.

Thank you.

Error Messages:

[armeabi] Compile++ thumb: hello-jni <= hello-jni.cpp
In file included from .../android-ndk-r9c/tbb42_20131118oss/include/tbb/tbb_exception.h:130:0,
                 from .../android-ndk-r9c/tbb42_20131118oss/include/tbb/parallel_for.h:36,
                 from jni/hello-jni.cpp:19:
.../android-ndk-r9c/tbb42_20131118oss/include/tbb/tbb_allocator.h: In member function 'void tbb::tbb_allocator<T>::construct(U*, Args&& ...)':
.../android-ndk-r9c/tbb42_20131118oss/include/tbb/tbb_allocator.h:130:30: error: 'forward' is not a member of 'std'
.../android-ndk-r9c/tbb42_20131118oss/include/tbb/tbb_allocator.h:130:47: error: expected primary-expression before '>' token
jni/hello-jni.cpp: At global scope:

Environemt: Android NDKr9c on MAC OS.

Related SW versions: tbb42_20131118oss.

Related Configuration 

  • Application.mk
APP_ABI := armeabi armeabi-v7a
APP_STL := stlport_shared
APP_GNUSTL_FORCE_CPP_FEATURES := exceptions rtti
  • Android.mk

     

LOCAL_CFLAGS += -DTBB_USE_GCC_BUILTINS -std=c++11 -I$(TBB_PATH)/include
LOCAL_SHARED_LIBRARIES := -ltbb -L$(TBB_PATH)/build/macos_arm_gcc_android_cc4.6_NDKr9c_version_android-9_release 
5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

hello, could you try to change the c++ library? 

APP_STL:=stlport_shared

to

APP_STL:=gnustl_shared

--Vladimir

 

First of all,  I have to thank you, Vladimir. 

I just tried Vladimir's comment.

  • ​Application.m
APP_ABI := armeabi armeabi-v7a
APP_STL := gnustl_shared
APP_GNUSTL_FORCE_CPP_FEATURES := exceptions rtti

 

It shows another errors:

nb10080010:hello-jni Hawx$ pwd
/Users/Hawx/sw/android/ndk/android-ndk-r9c/samples/hello-jni
nb10080010:hello-jni Hawx$ ../../ndk-build
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 3 in ./AndroidManifest.xml
Android NDK: Trying to define local module 'gnustl_shared' in jni/Android.mk.
Android NDK: But this module was already defined by /Users/Hawx/sw/android/ndk/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/Android.mk.
/Users/Hawx/sw/android/ndk/android-ndk-r9c/build/core/build-module.mk:34: *** Android NDK: Aborting.    .  Stop.

 

Here is my jni/Android.mk configuration:

LOCAL_PATH := $(call my-dir)
TBB_PATH := /Users/Hawx/sw/android/ndk/android-ndk-r9c/tbb42_20131118oss

include $(CLEAR_VARS)

LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.cpp
LOCAL_CFLAGS += -DTBB_USE_GCC_BUILTINS -std=c++11 -I$(TBB_PATH)/include
LOCAL_SHARED_LIBRARIES := -ltbb-L$(TBB_PATH)/build/macos_arm_gcc_android_cc4.6_NDKr9c_version_android-9_release/
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libtbb
LOCAL_SRC_FILES := libtbb.so
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libgnustl_shared
LOCAL_SRC_FILES := libgnustl_shared.so
include $(PREBUILT_SHARED_LIBRARY)

 

 

I had similar problem. You need to remove lines 17-20 (libgnustl_shared stuff) from  jni/Android.mk. 

libgnustl_shared.so should be picked up by "APP_STL := gnustl_shared" clause in Application.mk and copied to the folder next to your hello-jni library. and do not forget to load libraries in correct order in the java code.


	        System.loadLibrary("gnustl_shared");

	        System.loadLibrary("tbb");

	        System.loadLibrary("hello-jni");

BTW our latest development release contains tachyon example (<root>\examples\parallel_for\tachyon\android) that can be built for all architectures and it should show the path where it expects to see architecture-specific libtbb.so library.

--Vladimir

And BTW, there is a tutorial how to create apps with intel tbb library for android.

http://software.intel.com/en-us/android/articles/android-tutorial-writing-a-multithreaded-application-using-intel-threading-building-blocks

--Vladimir

Leave a Comment

Please sign in to add a comment. Not a member? Join today