1

As specified in this answer, I downloaded libjpeg 8d from github and placed it in a folder {ANDROID_APP}/jni/libjpeg. This library has it's own Android.mk, so I tried to include it at the end of my {ANDROID_APP}/jni/Android.mk this way :

include $(LOCAL_PATH)/libjpeg/Android.mk

Note : I'm using the latest version of android NDK (r8c)

After running ndk-build, I still get this error :

ANDROID_APP/jni/libfoo/foo_analysis.c:36:21: fatal error: jpeglib.h: No such file or directory

This is the structure of my global Android.mk :

LOCAL_PATH := $(call my-dir)

# libFoo
include $(CLEAR_VARS) 

LOCAL_MODULE := libfoo
LOCAL_MODULE_FILENAME := libfoo
LOCAL_SRC_FILES := libfoo/foo.c libfoo/foo_analysis.c libfoo/foo_extract.c

LOCAL_STATIC_LIBRARIES := libbmp # declared previously but not shown in this example

LOCAL_CFLAGS   = ${FLAGS}
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libfoo
LOCAL_EXPORT_LDLIBS := -llog

include $(BUILD_STATIC_LIBRARY)

# libBar
include $(CLEAR_VARS)

LOCAL_MODULE := libbar
LOCAL_MODULE_FILENAME := libbar
LOCAL_SRC_FILES := bar/bar.c

LOCAL_STATIC_LIBRARIES := libfoo

LOCAL_CFLAGS   = ${FLAGS}
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/bar
LOCAL_EXPORT_LDLIBS := -llog

include $(BUILD_STATIC_LIBRARY)

# callbar
LOCAL_MODULE := libcallbar
LOCAL_MODULE_FILENAME := libcallbar
LOCAL_SRC_FILES := com_androidapp_nativeC_callbar.c

LOCAL_STATIC_LIBRARIES := libbar

LOCAL_CFLAGS   = ${FLAGS}

include $(BUILD_SHARED_LIBRARY)

#libjpeg
include $(LOCAL_PATH)/libjpeg/Android.mk

I tried to use LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/libfoo $(LOCAL_PATH)/libjpeg and LOCAL_C_INCLUDES := $(LOCAL_PATH)/libjpeg in the libFoo module, but I still get the same error.

Community
  • 1
  • 1
Jerec TheSith
  • 1,932
  • 4
  • 32
  • 41

1 Answers1

2

Just looked at Android.mk in jpeg8d-master folder and seems to be it has nothing.

I was trying to compile library directly according to STANDALONE-TOOLCHAIN.HTML

I do next: $export NDKROOT=/home/alex/tools/android-ndk-r8c (where is your NDK) $export SYSROOT=$NDKROOT/platforms/android-9/arch-arm (or any other android platform)

but files from jpeg8d-master have windows \r symbols and I deleted config.guess, config.sub, depcomp than use $automake -a command. And replace ltmain.sh from glib-2.34.0

than $./configure CC="$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=$SYSROOT" --host=arm-linux-androideabi $make

next try prebuilts feature NDK - How to use a generated .so library in another project and NDK/PREBUILTS.HTML

Community
  • 1
  • 1
Alex Bezuglyi
  • 540
  • 4
  • 9