How do you find an Android module by name in AOSP? - android

I am building AOSP Kitkat (4.4) and trying to find the Android.mk file that defines the libnfc-nci module. The libnfc_nci_jni module depends on this local shared library (Android.mk included below) and I want to see the source that generates this .so file. I know that the nfc.h exists in /hardware/libhardware/include/hardware/nfc.h, but that is only the headers.
As far as I know, the available tools for searching android source code are cgrep, jgrep, and resgrep. However, (to my knowledge) these don't search Android.mk files. Is there a tool that I'm missing that I can use to find the directory that contains the module libnfc-nci?
Here is the Android.mk for libnfc_nci_jni (found in /packages/apps/Nfc/nci/jni/Android.mk)
VOB_COMPONENTS := external/libnfc-nci/src
NFA := $(VOB_COMPONENTS)/nfa
NFC := $(VOB_COMPONENTS)/nfc
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
ifneq ($(NCI_VERSION),)
LOCAL_CFLAGS += -DNCI_VERSION=$(NCI_VERSION) -O0 -g
endif
LOCAL_CFLAGS += -Wall -Wextra
define all-cpp-files-under
$(patsubst ./%,%, \
$(shell cd $(LOCAL_PATH) ; \
find $(1) -name "*.cpp" -and -not -name ".*") \
)
endef
LOCAL_SRC_FILES:= $(call all-cpp-files-under, .)
LOCAL_C_INCLUDES += \
bionic \
bionic/libstdc++ \
external/stlport/stlport \
external/libxml2/include \
external/icu4c/common \
frameworks/native/include \
libcore/include \
$(NFA)/include \
$(NFA)/brcm \
$(NFC)/include \
$(NFC)/brcm \
$(NFC)/int \
$(VOB_COMPONENTS)/hal/include \
$(VOB_COMPONENTS)/hal/int \
$(VOB_COMPONENTS)/include \
$(VOB_COMPONENTS)/gki/ulinux \
$(VOB_COMPONENTS)/gki/common
LOCAL_SHARED_LIBRARIES := \
libicuuc \
libnativehelper \
libcutils \
libutils \
liblog \
libnfc-nci \
libstlport
LOCAL_STATIC_LIBRARIES := libxml2
LOCAL_MODULE := libnfc_nci_jni
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
I am running Ubuntu 14.04

I found libnfc-nci in /external/libnfc-nci after some more googling. It seems there is no better tool to search aosp for a module than google (unless you write your own script).
As Gabe Sechan noted, a grep solution is possible. Here is the command I used that seemed to do the trick (working directory is the root of AOSP).
grep -inIEr "LOCAL_MODULE := libnfc-nci" .

You should try :
godir libnfc-nci
It should give you options in case thete ae several such directories

Related

Error: missing android-support-constraint-layout in AOSP but prebuilts/sdk/current/extras has it

My Android source repo already has two jar files android-support-constraint-layout.jar and android-support-constraint-layout-solver.jar respectively at prebuilts/sdk/current/extras/constraint-layout/libs/ and prebuilts/sdk/current/extras/constraint-layout-solver/. Now, I have an app in packages/app, where I have an app/src/main/Android.mk:
LOCAL_STATIC_ANDROID_LIBRARIES := \
...
android-support-constraint-layout \
android-support-constraint-layout-solver
Still, I get the following error after compiling Android:
error: FirstApp (APPS android-x86) missing android-support-constraint-layout (JAVA_LIBRARIES android-x86)
You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.
error: FirstApp (APPS android-x86) missing android-support-constraint-layout-solver (JAVA_LIBRARIES android-x86)
Except the first, none of the methods in this link works to add constraint-layout in AOSP.
I added constraint-layout in one of the packages in AOSP for Android-Oreo (v8.1).
Download the constraint-layout (.aar) and constraint-layout-solver (.jar) from maven repository: https://mvnrepository.com/artifact/com.android.support.constraint/constraint-layout/1.0.2,
https://mvnrepository.com/artifact/com.android.support.constraint/constraint-layout-solver/1.0.2
Put them in the libs/ folder in the app's home (packages/apps/AnotherFirstApp/).
In Android.mk:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := AnotherFirstApp
LOCAL_MODULE_TAGS := optional
LOCAL_DEX_PREOPT := false
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PROGUARD_FLAG_FILES := ../../../frameworks/support/design/proguard-rules.pro
ifeq ($(TARGET_BUILD_APPS),)
support_library_root_dir := frameworks/support
else
support_library_root_dir := prebuilts/sdk/current/support
endif
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
$(support_library_root_dir)/design/res \
$(support_library_root_dir)/v7/cardview/res \
$(support_library_root_dir)/v7/recyclerview/res \
$(support_library_root_dir)/v7/appcompat/res
LOCAL_AAPT_FLAGS := \
--auto-add-overlay \
--extra-packages android.support.design \
--extra-packages android.support.v7.cardview \
--extra-packages android.support.constraint \
--extra-packages android.support.v7.recyclerview \
--extra-packages android.support.v7.appcompat
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-design \
android-support-v7-recyclerview \
android-support-v4 \
android-support-v7-cardview \
android-support-v7-appcompat \
constraint-layout-solver \
LOCAL_STATIC_JAVA_AAR_LIBRARIES := \
constraint-layout
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
constraint-layout:libs/constraint-layout-1.0.2.aar \
constraint-layout-solver:libs/constraint-layout-solver-1.0.2.jar
include $(BUILD_MULTI_PREBUILT)
include $(call all-makefiles-under,$(LOCAL_PATH))
Now, there's no problem. The app builds and runs fine. There might be one issue because of not adding constraint-solver in a way like shared jar, in case other apps are also trying to use this jar. This needs to be handled by adding this jar in the framework or external.
I got help from the following blogs:
https://sites.google.com/site/sbobovyc/home/Programming/a/creating-system-app
http://saurabhsharma123k.blogspot.com/2017/03/add-and-use-external-library-or-jar.html
https://kevinaboos.wordpress.com/2016/10/29/adding-an-external-library-or-jarfile-to-android-frameworks/
https://github.com/BrahmaOS/brahmaos-packages-apps-GoodWeather/blob/master/Android.mk

java.lang.UnsatisfiedLinkError: cannot locate symbol from a dependent shared library

I saw some crash reports from few devices (all arm64 acrhitecture) that looked like that:
Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNK6TagLib4File10propertiesEv" referenced by "/data/app/com.app.my/lib/arm64/libtaglib-wrapper.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:988)
at helpers.TagReaderService.(SourceFile)
The OS version affected is 5.1. Since I read that the same problem (but related to system dependencies) happens because of wrong APP_PLATFORM, I double checked that it was right and in fact I'm targeting android-16.
I should mention that the symbol is declared in another shared library taglib.so which is then linked to the second one taglib-wrapper.so.
I also performed an objdump of both
taglib.so:
0000000000140590 g DF .text 000000000000004c Base TagLib::File::properties() const
and taglib-wrapper.so:
0000000000000000 DF *UND* 0000000000000000 TagLib::File::properties() const
So the symbol get correctly propagated to the taglib-wrapper.so library.
Personally I'm using a arm64 device and have no issue.
I also checked that the Application.mk was not being ignored adding random chars to it and performing a Gradle build. No relevant NDK-config code inside gradle.build file.
You can file the cpp code on the Git repo.
Application.mk
APP_STL := c++_shared
APP_ABI := arm64-v8a x86 armeabi-v7a
APP_PLATFORM := android-16
APP_CPPFLAGS += -frtti -fexceptions
Android.mk
LOCAL_PATH:= $(call my-dir)
# ======= TagLib engine ============================
include $(CLEAR_VARS)
LOCAL_MODULE := taglib
LOCAL_C_INCLUDES := $(LOCAL_PATH)/taglib \
$(LOCAL_PATH)/taglib/ape \
$(LOCAL_PATH)/taglib/asf \
$(LOCAL_PATH)/taglib/dsf \
$(LOCAL_PATH)/taglib/ebml \
$(LOCAL_PATH)/taglib/ebml/matroska \
$(LOCAL_PATH)/taglib/flac \
$(LOCAL_PATH)/taglib/it \
$(LOCAL_PATH)/taglib/mod \
$(LOCAL_PATH)/taglib/mp4 \
$(LOCAL_PATH)/taglib/mpc \
$(LOCAL_PATH)/taglib/mpeg \
$(LOCAL_PATH)/taglib/mpeg/id3v1 \
$(LOCAL_PATH)/taglib/mpeg/id3v2 \
$(LOCAL_PATH)/taglib/mpeg/id3v2/frames \
$(LOCAL_PATH)/taglib/ogg \
$(LOCAL_PATH)/taglib/ogg/flac \
$(LOCAL_PATH)/taglib/ogg/opus \
$(LOCAL_PATH)/taglib/ogg/speex \
$(LOCAL_PATH)/taglib/ogg/vorbis \
$(LOCAL_PATH)/taglib/riff \
$(LOCAL_PATH)/taglib/riff/aiff \
$(LOCAL_PATH)/taglib/riff/wav \
$(LOCAL_PATH)/taglib/s3m \
$(LOCAL_PATH)/taglib/toolkit \
$(LOCAL_PATH)/taglib/trueaudio \
$(LOCAL_PATH)/taglib/wavpack \
$(LOCAL_PATH)/taglib/xm
FILE_LIST := $(wildcard $(LOCAL_PATH)/taglib/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/taglib/**/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/taglib/**/**/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/taglib/**/**/**/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_EXPORT_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
# ======= TagLib wrapper ===========================
include $(CLEAR_VARS)
LOCAL_MODULE := taglib-wrapper
LOCAL_C_INCLUDES := $(LOCAL_PATH)/taglib \
$(LOCAL_PATH)/taglib/ape \
$(LOCAL_PATH)/taglib/asf \
$(LOCAL_PATH)/taglib/dsf \
$(LOCAL_PATH)/taglib/ebml \
$(LOCAL_PATH)/taglib/ebml/matroska \
$(LOCAL_PATH)/taglib/flac \
$(LOCAL_PATH)/taglib/it \
$(LOCAL_PATH)/taglib/mod \
$(LOCAL_PATH)/taglib/mp4 \
$(LOCAL_PATH)/taglib/mpc \
$(LOCAL_PATH)/taglib/mpeg \
$(LOCAL_PATH)/taglib/mpeg/id3v1 \
$(LOCAL_PATH)/taglib/mpeg/id3v2 \
$(LOCAL_PATH)/taglib/mpeg/id3v2/frames \
$(LOCAL_PATH)/taglib/ogg \
$(LOCAL_PATH)/taglib/ogg/flac \
$(LOCAL_PATH)/taglib/ogg/opus \
$(LOCAL_PATH)/taglib/ogg/speex \
$(LOCAL_PATH)/taglib/ogg/vorbis \
$(LOCAL_PATH)/taglib/riff \
$(LOCAL_PATH)/taglib/riff/aiff \
$(LOCAL_PATH)/taglib/riff/wav \
$(LOCAL_PATH)/taglib/s3m \
$(LOCAL_PATH)/taglib/toolkit \
$(LOCAL_PATH)/taglib/trueaudio \
$(LOCAL_PATH)/taglib/wavpack \
$(LOCAL_PATH)/taglib/xm
LOCAL_SRC_FILES := taglib.cpp
LOCAL_LDLIBS := -llog
LOCAL_SHARED_LIBRARIES := taglib
include $(BUILD_SHARED_LIBRARY)
UPDATE:
I merged the two library inside an unique shared library. Now that same device (Meizu MX4) crashes at the first JNI call of that library:
java.lang.UnsatisfiedLinkError: No implementation found for void helpers.IOWrapper.initialize() (tried Java_helpers_IOWrapper_initialize and Java_helpers_IOWrapper_initialize__) at helpers.IOWrapper.initialize(Native Method) at helpers.IOWrapper.read(SourceFile:136) at helpers.IOWrapper.read(SourceFile:123) at helpers.TagReaderService$a.run(SourceFile:58) at java.lang.Thread.run(Thread.java:818)
How is possible that it's the only device crashing? I'm loading the library thought static declaration is the same Java class. I'm using extern C declaration to wrap the cpp file. Maybe it's because I'm missing JNIEXPORT and JNICALL?

How to set Build ID of a elf file in Android.mk

I recently need to set specific build-id to a elf file in Android.
Firstly,I use shell command like this:
arm-linux-androideabi-gcc -pie -Wl,--build-id=0xFFFFFFFF --sysroot /home/chengyi/code/android_6.0.1_bullhead/prebuilts/ndk/9/platforms/android-18/arch-arm main.c
readelf -n a.out.everthing is OK.
Above is only a demo,I need to set build-id in Android.mk at last.here is my Android.mk:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
main.cpp
LOCAL_SHARED_LIBRARIES := \
liblog \
libdl \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/ \
bionic \
LOCAL_MODULE:= a.out
LOCAL_CXXFLAGS := \
-pie -Wl,--build-id=0xFFFFFFFFFFFFFFFFFF --sysroot /home/chengyi/code/android_6.0.1_bullhead/prebuilts/ndk/9/platforms/android-18/arch-arm \
include $(BUILD_EXECUTABLE)
The output elf file has a constant build-id,no matter how I strive.
Is there any method to set a specific build-id to elf file in Android.mk?
Thanks a lot for any help.
If you want to set build-id by Android.mk. Don't use variable LOCAL_CXXFLAGS or LOCAL_CFLAGS.
build-id is sent to linker,so you need to use LOCAL_LDFLAGS like this:
LOCAL_LDFLAGS += -Wl,--build-id=0xFFFFFFFFFFFFFF

Compiling tesseract through android NDK

I am trying to compile tesseract for android using android ndk r5, code of tesseract is obtained by checking out http://code.google.com/p/tesseract-android-tools/, i am unable to compile tesseract and got errors,
Install : libjpeg.so => libs/armeabi/libjpeg.so
make: *** No rule to make target `//cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/jni/../external/leptonlib-1.66/src/adaptmap.c', needed b
y `/cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/obj/local/armeabi/objs/lept//cygdrive/e/DemoExamples_WorkSpace/tesseract-android-tools/j
ni/../external/leptonlib-1.66/src/adaptmap.o'. Stop.
Please help me to sort out this problem.
I had the same issue and I think I solved it. May be helpful for those who get similar errors:
On OSX, I just changed the Android.mk files by giving the absolute paths as follows
First: jni/Android.mk
TESSERACT_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/tesseract-3.00
LEPTONICA_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/leptonlib-1.66
LIBJPEG_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/external/libjpeg
Then: jni/com_googlecode_leptonica_android/Android.mk
REAL_LOCAL_PATH := /Users/.../tesseract-android-tools/tesseract-android-tools/jni/com_googlecode_leptonica_android
and jni/com_googlecode_tesseract_android/Android.mk accordingly.
I believe the problem is caused by the relative path which is returned by the following command:
$(call my-dir)
Then I needed to run the ndk-build as superuser and all compiled just fine.
Search for adaptmap among the makefiles. Build the makefile that creates this module first.
So, I have compiled in windows 7 and windows xp, but it´s an ugly workaround.
The basic problem is "LOCAL_PATH := "with blank value, I don´t know why cygwin have problem with this, so you have to change paths on Android.mk files to work.
I will refer for Android.mk using numbers, my jni path is:
-jni
Android.mk(1)
Aplication.Mk
-com_googlecode_tesseract_android(dir)
Android.mk(2)
tesseract(dir)
-com_googlecode_leptonica_android(dir)
Android.mk(3)
leptonlib(dir)
-libjpeg
Android.mk(4)
=================================
Android.mk(1)
Put tesseract and leptonica sources on googlecode subdirectories like this:
TESSERACT_PATH := $(call my-dir)/com_googlecode_tesseract_android/tesseract -- directory to source, change for respective name
LEPTONICA_PATH := $(call my-dir)/com_googlecode_leptonica_android/leptonlib -- directory to source, change for respective name
LIBJPEG_PATH := $(call my-dir)/libjpeg
=================================
Android.mk(2)
1 - Change:
LOCAL_PATH:=
to
LOCAL_PATH:= $(call my-dir)
2 - Change:
BLACKLIST_SRC_FILES := \
%endiantest.c \
%freetype.c \
%xtractprotos.c
LOCAL_SRC_FILES := \
$(filter-out $(BLACKLIST_SRC_FILES),$(wildcard $(LEPTONICA_PATH)/src/*.c))
to
LOCAL_SRC_FILES := \
leptonlib/src/adaptmap.c \
leptonlib/src/affine.c \
leptonlib/src/affinecompose.c \ ... continue (Put all the files on src directory, without files listed on blacklist).
Note: replace leptonlib for subrectory name of leptonlib source.
3- Change:
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SRC_FILES += \
$(REAL_LOCAL_PATH)/stdio/open_memstream.c \
$(REAL_LOCAL_PATH)/stdio/fopencookie.c \
$(REAL_LOCAL_PATH)/stdio/fmemopen.c
LOCAL_C_INCLUDES += \
$(REAL_LOCAL_PATH)/stdio
endif
# jni
LOCAL_SRC_FILES += \
$(REAL_LOCAL_PATH)/box.cpp \
$(REAL_LOCAL_PATH)/pix.cpp \
$(REAL_LOCAL_PATH)/pixa.cpp \
$(REAL_LOCAL_PATH)/utilities.cpp \
$(REAL_LOCAL_PATH)/readfile.cpp \
$(REAL_LOCAL_PATH)/writefile.cpp \
$(REAL_LOCAL_PATH)/jni.cpp
LOCAL_C_INCLUDES += \
$(REAL_LOCAL_PATH) \
$(LEPTONICA_PATH)/src
to
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SRC_FILES += \
stdio/open_memstream.c \
stdio/fopencookie.c \
stdio/fmemopen.c
LOCAL_C_INCLUDES += \
stdio
endif
# jni
LOCAL_SRC_FILES += \
box.cpp \
pix.cpp \
pixa.cpp \
utilities.cpp \
jni.cpp
LOCAL_C_INCLUDES += \
leptonlib/src
=================================
Android.mk(3)
1 - Change:
LOCAL_PATH:=
to
LOCAL_PATH:= $(call my-dir)
2 - Change
On LOCAL_SRC_FILES change $(TESSERACT_PATH) to tesseract --Note: replace tesseract for subrectory name of tesseract source.
DON´T REPLACE $(TESSERACT_PATH) on LOCAL_C_INCLUDES only LOCAL_SRC_FILES.
DON´T REPLACE $(LEPTONICA_PATH) on LOCAL_C_INCLUDES.
3 - Change:
In #jni
LOCAL_SRC_FILES += \
$(REAL_LOCAL_PATH)/tessbaseapi.cpp
LOCAL_C_INCLUDES += \
$(REAL_LOCAL_PATH) \
$(TESSERACT_PATH)/api \
$(LEPTONICA_PATH)/src
to
LOCAL_SRC_FILES += \
tessbaseapi.cpp
LOCAL_C_INCLUDES += \
$(LOCAL_PATH) \
$(TESSERACT_PATH)/api \
$(LEPTONICA_PATH)/src
For me working on windows 7, windows xp, Mac and Ubuntu.

Issue trying to build PocketSphinx for Android using the NDK on Windows with Cygwin

I'm currently trying to build the PocketSphinx library for Android using the NDK on Windows with Cygwin. I have the PocketSphinxAndroidDemo project code. I also have the pocketsphinx and shpinxbase projects as sub folders of the E:/Development/CMUSphinx folder.
I'm trying to build using ndk-build from the project folder. The Android.mk file in the /jni/ folder of the project looks like this -
# Build the native component of the PocketSphinx library for Android.
# You MUST change this to the absolute path of the directory containing
# sphinxbase and pocketsphinx source code.
SPHINX_PATH := E:/Development/CMUSphinx
# Copy this Android.mk along with pocketsphinx_wrap.c and the contents of the 'edu' folder
# built by swig to the jni/ directory of your Android project.
BASE_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_PATH := $(SPHINX_PATH)/sphinxbase/src/libsphinxbase/util
LOCAL_MODULE := sphinxutil
LOCAL_SRC_FILES := \
bio.c \
bitvec.c \
case.c \
ckd_alloc.c \
cmd_ln.c \
dtoa.c \
err.c \
errno.c \
f2c_lite.c \
filename.c \
genrand.c \
glist.c \
hash_table.c \
heap.c \
huff_code.c \
info.c \
listelem_alloc.c \
logmath.c.arm \
matrix.c \
mmio.c \
pio.c \
profile.c \
sbthread.c \
strfuncs.c \
utf8.c
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_PATH := $(SPHINX_PATH)/sphinxbase/src/libsphinxbase/fe
LOCAL_MODULE := sphinxfe
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES := \
fe_interface.c \
fe_sigproc.c \
fe_warp_affine.c \
fe_warp.c \
fe_warp_inverse_linear.c \
fe_warp_piecewise_linear.c \
fixlog.c
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_PATH := $(SPHINX_PATH)/sphinxbase/src/libsphinxbase/feat
LOCAL_MODULE := sphinxfeat
LOCAL_SRC_FILES := \
agc.c \
cmn.c \
cmn_prior.c \
feat.c \
lda.c
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_PATH := $(SPHINX_PATH)/sphinxbase/src/libsphinxbase/lm
LOCAL_MODULE := sphinxlm
LOCAL_SRC_FILES := \
fsg_model.c \
jsgf.c \
jsgf_parser.c \
jsgf_scanner.c \
lm3g_model.c \
ngram_model_arpa.c \
ngram_model_dmp.c \
ngram_model_set.c \
ngram_model.c
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include \
$(SPHINX_PATH)/pocketsphinx/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_PATH := $(SPHINX_PATH)/pocketsphinx/src/libpocketsphinx
LOCAL_MODULE := pocketsphinx
LOCAL_SRC_FILES := \
acmod.c \
bin_mdef.c \
blkarray_list.c \
dict.c \
dict2pid.c \
fsg_history.c \
fsg_lextree.c \
fsg_search.c \
hmm.c.arm \
mdef.c \
ms_gauden.c.arm \
ms_mgau.c.arm \
ms_senone.c.arm \
ngram_search.c \
ngram_search_fwdtree.c \
ngram_search_fwdflat.c \
phone_loop_search.c \
pocketsphinx.c \
ps_lattice.c \
ps_mllr.c \
ptm_mgau.c.arm \
s2_semi_mgau.c.arm \
tmat.c \
vector.c
include $(BUILD_STATIC_LIBRARY)
# Create the dynamic library wrapper
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include \
$(SPHINX_PATH)/pocketsphinx/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_PATH := $(BASE_PATH)
LOCAL_MODULE := pocketsphinx_jni
LOCAL_SRC_FILES := pocketsphinx_wrap.c
PRIVATE_WHOLE_STATIC_LIBRARIES := \
$(call static-library-path,sphinxutil) \
$(call static-library-path,sphinxfe) \
$(call static-library-path,sphinxfeat) \
$(call static-library-path,sphinxlm) \
$(call static-library-path,pocketsphinx)
LOCAL_STATIC_LIBRARIES := sphinxutil sphinxfe sphinxfeat sphinxlm pocketsphinx
include $(BUILD_SHARED_LIBRARY)
When I run the ndk-build command I get the following error:
build-binary.mk:197: *** target pattern contains no '%'. Stop.
I can build all the ndk samples just fine. Any clue what's causing this error? Many thanks in advance!
Jason, Edit jni/Android.mk file
Change Line 162 :
LOCAL_STATIC_LIBRARIES := sphinxutil sphinxfe sphinxfeat sphinxlm pocketsphinx
to :
LOCAL_STATIC_LIBRARIES := pocketsphinx sphinxlm sphinxfeat sphinxfe sphinxutil
That will resolve your issue.
Do you know if this project has been previously built using cygwin with success? Cygwin has a number of oddities, from the awkward combination of windows drive letters with unix paths, to interpreting an inadvertent double slash in an assembled path unusually, and more. You could try the /cygdrive/e/ type of path instead of a drive letter, but who knows if that will help.
Jason,
you have to change your sphinx path to cygwin format i.e without ":"
change
SPHINX_PATH := E:/Development/CMUSphinx
to
SPHINX_PATH := /cygdrive/e/Development/CMUSphinx
this will fix the error
I used following link for Building Pocketsphinx On Android On Windows
https://sites.google.com/site/opiatefuchs/home/pocketsphinxandroiddemo but it misses one step that #Hitesh mentioned about replacing LOCAL_STATIC_LIBRARIES in jni/Android.mk file and I was able to build to latest 0.8 version.. thanks #Hitesh

Categories

Resources