Fix android build compatibility problems
authorCaiwen Zhang <caiwen.zhang@intel.com>
Thu, 25 Dec 2014 10:37:00 +0000 (18:37 +0800)
committerCaiwen Zhang <caiwen.zhang@intel.com>
Fri, 26 Dec 2014 02:03:41 +0000 (10:03 +0800)
commitf56a9ad5a7c86609cf8895e8a579fb192f0ebfdb
tree0cfb3f4054e74f7704eae14d810fee36d044f822
parent1bd624d173619b630736943982534bcb446dd3aa
Fix android build compatibility problems

1. Some C++11 features are used in IoTivity. Old Android NDK may doesn't
support a part of these features directly. Implement and include it if
it is required.

2. Fix libc function missing problem. Some functions, e.g. rand, srand.
strtof ... are static inline prior to android-L(it is defined and
implemented in the header file). So before android-L libc.so doesn't
include them. If build on android-L and run on an old platform(earlier
than android-L), there will be 'can't locate xxx' problem.

e.g.:
rand, it is defined in stdlib.h as "static __inline__ int rand() { ....} in
the ndk < 10. it's defined as 'extern int rand();' from ndk-10x. With old
ndk, if a file (x.c) used 'rand' function, when build x.c, 'rand' is compiled
into x.o. 'rand' won't exit in neither libc.so nor libc.a. If build an
application with ndk-10x and run it on emulator or device(developed with
NDK < 10), it requires implement 'rand' function by owerself or there
will be be 'can't locate rand' problem.

For convenience, add these functions in a file, if necessary, build it as
library and auto link into binary.

Change-Id: If47da94db7d06fde9887eba335bc0c67762514a9
Signed-off-by: Caiwen Zhang<caiwen.zhang@intel.com>
17 files changed:
build_common/android/SConscript
build_common/android/compatibility/android_cpp11_compat.cpp [new file with mode: 0644]
build_common/android/compatibility/android_cpp11_compat.h [new file with mode: 0644]
build_common/android/compatibility/c_compat.c [new file with mode: 0644]
build_common/android/compatibility/c_compat.scons [new file with mode: 0644]
build_common/android/compatibility/cpp11_compat.scons [new file with mode: 0644]
build_common/android/jni/Android.mk
resource/examples/SConscript
resource/examples/ocicuc/SConscript
resource/include/OCRepresentation.h
resource/oc_logger/SConscript
resource/oc_logger/examples/SConscript
resource/src/SConscript
service/SConscript
service/notification-manager/SConscript
service/protocol-plugin/plugins/SConscript
service/things-manager/SConscript