Wednesday, April 17, 2013

[android help] Using APP_STL and Application.mk files in AOSP's external/


I have written several C++ librairies/programs to be used on an Android system. These libraries compile well and are fully tested on x86 using gcc-4.4/gcc4.6. I would like to compile these libraries for ARM without using the NDK's toolchain.


Instead, I would like to place this libraries in the external/ folder of my Android 4.0.4 project where all the external C/C++ libraries needed by Android are actually living. The advantage of this is that the librairies/executables I will compile will be automatically copied in the good path at compile time. Plus, this will allow me to build the whole firmware once including all the dependencies. Finally, this also has the advantage that statical assertions may cause the whole build to fail if anything goes wrong.


I have no trouble doing this for C programs, the problems arise when trying to compile C++ programs that depends on GNU STL. I am aware that Android do not use GNU STL by default and would like to know how I can link my libraries/executables against it as I have already tried the classical Android.mk and Application.mk methods.


The APP_STL variable in my Application.mk seems to be ignored when making my library. I am sourcing and lunching before making.


Here's what my Makefiles look like :


Android.mk



LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libuinput++

LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/include

LOCAL_CFLAGS := -W -Os -fPIC

LOCAL_SRC_FILES := src/Device.cpp \
src/DeviceConnection.cpp \
src/ConnectionManager.cpp \
src/OutputStream.cpp \
src/Command.cpp

LOCAL_CPP_FEATURES += exceptions

include $(BUILD_STATIC_LIBRARY)


Application.mk



APP_PROJECT_PATH := $(shell pwd)
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk
APP_STL := gnustl_static


The errors I get :



src/include/Device.hpp:4:18: error: string: No such file or directory
src/include/Device.hpp:5:20: error: stdint.h: No such file or directory


Any tips ?



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...