[android-ndk] How to refer to a system library header in a prebuilt shared library

561 views
Skip to first unread message

deepak subramanian

unread,
Oct 25, 2011, 1:05:30 AM10/25/11
to android-ndk
I am building a library which depends on a a prebuilt library. This prebuilt library in turn depends on the GL system library. However, I am finding issues when I am referring to this library when declaring the prebuilt system library module. In the below case, I am getting the error as GLES/gl.h not found. 

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= cvd
LOCAL_SRC_FILES:=libs/libcvd.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/usr/local/include/cvd $(LOCAL_PATH)/../../../platforms/android-9/arch-arm/usr/include
LOCAL_C_INCLUDES :=$(LOCAL_PATH)/../../../platforms/android-9/arch-arm/usr/include
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM -ldl -llog
include $(PREBUILT_SHARED_LIBRARY)

I have tired to put the the $(LOCAL_PATH)/../../../platforms/android-9/arch-arm/usr/include where the GLES folder is located however I have not been able to achieve any success.

I also tried 

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:= cvd
LOCAL_SRC_FILES:=libs/libcvd.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/usr/local/include/cvd $(LOCAL_PATH)/../../../platforms/android-9/arch-arm/usr/include \
$(LOCAL_PATH)/../../../platforms/android-9/arch-arm/usr/include
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM -ldl -llog
include $(PREBUILT_SHARED_LIBRARY)

but still nothing.  Kindly help

--Deepak

Cédric OCHS

unread,
Oct 25, 2011, 7:55:40 AM10/25/11
to andro...@googlegroups.com
You don't need to include system include folders in your Android.mk, they
are used automatically.

I suspect you didn't define "APP_PLATFORM := android-9" in your
Application.mk

Cédric

Le Tue, 25 Oct 2011 07:05:30 +0200, deepak subramanian
<deepa...@gmail.com> a écrit:

deepak subramanian

unread,
Oct 25, 2011, 9:49:37 PM10/25/11
to andro...@googlegroups.com
I have tried that and I still got the same error. The problem is that the system file is being used in a header file in the shared library :(.
I used TARGET_PLATFORM in the Android.mk

--Deepak


On Tue, Oct 25, 2011 at 4:55 AM, Cédric OCHS <ker...@gmail.com> wrote:
You don't need to include system include folders in your Android.mk, they are used autromatically.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


cuzz

unread,
Nov 9, 2011, 12:59:09 AM11/9/11
to android-ndk
I tried android-ndk-r6 on windows, with Cygwin.

TARGET_PLATFORM in the Android.mk can not help. But there's no error
if you use ndk-build with TARGET_PLATFORM.For example:

cd /cygdrive/d/android-ndk-r6/samples/san-angeles/jni

$NDK/ndk-build NDK_PROJECT_PATH=./ APP_BUILD_SCRIPT=./Android.mk
TARGET_PLATFORM=android-5

Maybe it's NDK's bug.


David Turner

unread,
Nov 9, 2011, 2:20:41 AM11/9/11
to andro...@googlegroups.com
You should not define TARGET_PLATFORM, try APP_PLATFORM inside the Application.mk (*not* the Android.mk) instead.
That's the documented way to to it.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.

cuzz

unread,
Nov 9, 2011, 8:53:28 PM11/9/11
to android-ndk
That's true. I have tried.

But I found no words to descripe APP_PLATFORM in NDK documents.
Except this paragraph in Android NDK ChangeLog:

--- Note that by default, code is still generated for ARM-based
devices.
--- You can however add 'x86' to your APP_PLATFORM (*should be
APP_ABI*) definition in your
--- Application.mk. For example, the following line instructs
ndk-build
--- to build your code for three distinct ABIs:

--- APP_ABI := armeabi armeabi-v7a x86

David Turner

unread,
Nov 10, 2011, 4:39:17 PM11/10/11
to andro...@googlegroups.com
On Thu, Nov 10, 2011 at 2:53 AM, cuzz <cuzz...@gmail.com> wrote:
That's true.  I have tried.

But I found no words to descripe APP_PLATFORM in NDK documents.
Except this paragraph in Android NDK ChangeLog:

APP_PLATFORM was for a long time not documented. It should be in docs/APPLICATION-MK.html since NDK r6 I believe though.
 
     --- Note that by default, code is still generated for ARM-based
devices.
     --- You can however add 'x86' to your APP_PLATFORM (*should be
APP_ABI*)  definition in your

Yep, that's a typo, thanks for mentioning this.
 
     --- Application.mk. For example, the following line instructs
ndk-build
     --- to build your code for three distinct ABIs:

          ---   APP_ABI := armeabi armeabi-v7a x86



On 11月9日, 下午3时20分, David Turner <di...@android.com> wrote:
> You should not define TARGET_PLATFORM, try APP_PLATFORM inside the
> Application.mk (*not* the Android.mk) instead.
> That's the documented way to to it.
>

Reply all
Reply to author
Forward
0 new messages