How to build Boost in Android NDK? - android

I am trying to debug v8 in my Android app.
I integrated v8 and it is currently running.
I've found this repo which seems to be interesting as a starting point:
https://github.com/ahmadov/v8_inspector_example
This implementation uses Boast.Beast for socket related operations.
I got a Boast.Beast build for Android by using:
https://github.com/moritz-wundke/Boost-for-Android
I already imported libs and includes into my project and now I am trying to build NDK, but I have some problems with headers' files.
My Android.mk looks like this:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := v8_monolith
LOCAL_SRC_FILES := v8-dist/dist/$(TARGET_ARCH_ABI)/libv8_monolith.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := boost
LOCAL_SRC_FILES := boost/dist/$(TARGET_ARCH_ABI)/lib/libboost_system-clang-1_80.a
LOCAL_CPPFLAGS := \
-fexceptions \
-frtti
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := en8
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/v8-dist/include
BOOST := $(wildcard $(LOCAL_PATH)/boost/include/*.hpp)
LOCAL_C_INCLUDES += $(BOOST:$(LOCAL_PATH)/%=%)
LOCAL_SRC_FILES := \
en8.cpp \
marshall.cpp \
instrument.cpp \
localstorage.cpp \
runtime.cpp \
cpu_profile.cpp \
page_size.cpp \
disk_cleanup.cpp
LOCAL_CPPFLAGS := \
-std=c++17 \
-Wall \
-Wextra \
-Wpedantic \
-Wno-unused-parameter \
-Wno-variadic-macros \
-Wno-gnu-include-next \
-DV8_DEPRECATION_WARNINGS \
-DLEVELDB_PLATFORM_ANDROID
# Pointer compression should be enabled for 64-bit archs
ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH),arm64 x86_64))
LOCAL_CPPFLAGS += -DV8_COMPRESS_POINTERS
endif
LOCAL_LDLIBS := -llog
LOCAL_STATIC_LIBRARIES := v8_monolith leveldb boost
include $(BUILD_SHARED_LIBRARY)
I am trying to import this files:
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/asio/ip/tcp.hpp>
When building NDK I get: fatal error: 'boost/beast/core.hpp' file not found
Thanks.

Related

ndk-build No rule to make target

This is my android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
FREETYPE_SRC_PATH :=
LOCAL_MODULE := freetype
LOCAL_CFLAGS := -DANDROID_NDK \
-DFT2_BUILD_LIBRARY=1
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include_all \
$(FREETYPE_SRC_PATH)include \
$(FREETYPE_SRC_PATH)src
LOCAL_SRC_FILES := \
$(FREETYPE_SRC_PATH)src/autofit/autofit.c \
$(FREETYPE_SRC_PATH)src/base/basepic.c \
$(FREETYPE_SRC_PATH)src/base/ftapi.c \
$(FREETYPE_SRC_PATH)src/base/ftbase.c \
LOCAL_LDLIBS := -ldl -llog
include $(BUILD_SHARED_LIBRARY)
And this is Application.mk:
APP_PLATFROM := android-20
APP_ABI := armeabi-v7a x86
After i hit ndk-build on the terminal Android Studio, i got an error message:
make: *** No rule to make target '/app/src/main/jni/src/base/basepic.c
I've checked android.mk:
$(FREETYPE_SRC_PATH)src/autofit/autofit.c \
$(FREETYPE_SRC_PATH)src/base/basepic.c \
there is no whitespace. But still got an error.
Gradle model version=6.0.1, NDK version=21.1.6352462
I need to ndk-build without problem.. any i can do to solve this issue?
In your android.mk file you have FREETYPE_SRC_PATH empty. I guess it must be assigned as /app/src/main/jni/.

Unable to compile harfbuz_ng library using NDK

I am developing an application in which i am using indic-text-renderer for devnagri text renderering.As this is NDK library;i am trying to compile it using ndk-build command.
But it gives me following error:
Android NDK: Trying to define local module 'harfbuzz_ng' in /cygdrive/d/Project_WorkSpace/indic-text-renderer//jni/harfbuzz-ng/Android.mk.
Android NDK: But this module was already defined by /cygdrive/d/Project_WorkSpace/indic-text-renderer//jni/harfbuzz-ng/Android.mk.
My android.mk file is:
LOCAL_PATH := $(call my-dir)
MY_LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := complex-script-rendering
LOCAL_C_INCLUDES := $(LOCAL_PATH)/freetype/include $(LOCAL_PATH)/harfbuzz-ng/src
LOCAL_SRC_FILES := complex-script-rendering.c
LOCAL_STATIC_LIBRARIES := ft2 harfbuzz
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(MY_LOCAL_PATH)/freetype/Android.mk
include $(MY_LOCAL_PATH)/harfbuzz-ng/Android.mk
How can i resolve this error?
I am very new to the NDK programming,so pls let me know if this information is not sufficient
Edit:
freetype/Android.mk
ifndef USE_FREETYPE
USE_FREETYPE := 2.4.2
endif
ifeq ($(USE_FREETYPE),2.4.2)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
# compile in ARM mode, since the glyph loader/renderer is a hotspot
# when loading complex pages in the browser
#
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES:= \
src/base/ftbbox.c \
src/base/ftbitmap.c \
src/base/ftfstype.c \
src/base/ftglyph.c \
src/base/ftlcdfil.c \
src/base/ftstroke.c \
src/base/fttype1.c \
src/base/ftxf86.c \
src/base/ftbase.c \
src/base/ftsystem.c \
src/base/ftinit.c \
src/base/ftgasp.c \
src/raster/raster.c \
src/sfnt/sfnt.c \
src/smooth/smooth.c \
src/autofit/autofit.c \
src/truetype/truetype.c \
src/cff/cff.c \
src/psnames/psnames.c \
src/pshinter/pshinter.c
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/builds \
$(LOCAL_PATH)/include
LOCAL_CFLAGS += -W -Wall
LOCAL_CFLAGS += -fPIC -DPIC
LOCAL_CFLAGS += "-DDARWIN_NO_CARBON"
LOCAL_CFLAGS += "-DFT2_BUILD_LIBRARY"
# the following is for testing only, and should not be used in final builds
# of the product
#LOCAL_CFLAGS += "-DTT_CONFIG_OPTION_BYTECODE_INTERPRETER"
LOCAL_CFLAGS += -O2
LOCAL_MODULE:= libft2
include $(BUILD_STATIC_LIBRARY)
endif
harfbuzz-ng/android.mk
LOCAL_PATH:= $(call my-dir)
HARFBUZZ_SRC_FILES = \
src/hb-blob.cc \
src/hb-buffer-serialize.cc \
src/hb-buffer.cc \
src/hb-common.cc \
src/hb-fallback-shape.cc \
src/hb-face.cc \
src/hb-font.cc \
src/hb-ot-tag.cc \
src/hb-set.cc \
src/hb-shape.cc \
src/hb-shape-plan.cc \
src/hb-shaper.cc \
src/hb-tt-font.cc \
src/hb-unicode.cc \
src/hb-warning.cc \
src/hb-ot-layout.cc \
src/hb-ot-map.cc \
src/hb-ot-shape.cc \
src/hb-ot-shape-complex-arabic.cc \
src/hb-ot-shape-complex-default.cc \
src/hb-ot-shape-complex-indic.cc \
src/hb-ot-shape-complex-indic-table.cc \
src/hb-ot-shape-complex-myanmar.cc \
src/hb-ot-shape-complex-sea.cc \
src/hb-ot-shape-complex-thai.cc \
src/hb-ot-shape-normalize.cc \
src/hb-ot-shape-fallback.cc
#############################################################
# build the harfbuzz library
#
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:= \
$(HARFBUZZ_SRC_FILES) \
src/hb-icu.cc
LOCAL_CPP_EXTENSION := .cc
LOCAL_SHARED_LIBRARIES := \
libcutils \
libicuuc \
libicui18n \
libutils
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/src \
external/icu4c/common
LOCAL_CFLAGS += -DHB_NO_MT -DHAVE_OT -DHAVE_ICU
LOCAL_LDLIBS += -lpthread
LOCAL_MODULE:= libharfbuzz_ng
include $(BUILD_SHARED_LIBRARY)
#############################################################
# build the harfbuzz static library
#
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:= \
$(HARFBUZZ_SRC_FILES) \
src/hb-ucdn.cc \
src/hb-ucdn/ucdn.c
LOCAL_CPP_EXTENSION := .cc
LOCAL_STATIC_LIBRARIES := libft2
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/src \
external/freetype/include
LOCAL_CFLAGS += -DHB_NO_MT -DHAVE_OT -DHAVE_UCDN -DHAVE_FREETYPE
LOCAL_LDLIBS += -lpthread
LOCAL_MODULE:= libharfbuzz_ng
include $(BUILD_STATIC_LIBRARY)
I tried removing the entire BUILD_SHARED_LIBRARY block and it stopped complaining about re-defining problem,because I wanted to compile harfbuzz-ng just as a static library. You may give it a try.
The last time I got this error,is when I cross compile freetype and use it as a PRE-built static library in my project,I exported the NDK-MODULE-PATH and yet there's a line in my jni/Android.mk written include $(MY_LOCAL_PATH)/freetype/Android.mk
So I just comment out this line and everything works fine.
Because when you set NDK-MODULE-PATH , the compiler will look into your PATH directory and search for Android.mk and compile the source with it. please reference this,and I hope it will help you .
my jni/Android.mk looks like this:
LOCAL_PATH := $(call my-dir)
MY_LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE := complex-script-rendering
LOCAL_C_INCLUDES := $(LOCAL_PATH)/freetype/include $(LOCAL_PATH)/harfbuzz-ng/src
LOCAL_SRC_FILES := complex-script-rendering.c
LOCAL_STATIC_LIBRARIES := libfreetype libharfbuzz
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
$(call import-module,freetype)
#include $(MY_LOCAL_PATH)/freetype/Android.mk
include $(MY_LOCAL_PATH)/harfbuzz-ng/Android.mk
and harfbuzz-ng/Android.mk:
LOCAL_PATH:= $(call my-dir)
HARFBUZZ_SRC_FILES = \
src/hb-blob.cc \
src/hb-buffer-serialize.cc \
src/hb-buffer.cc \
src/hb-common.cc \
src/hb-fallback-shape.cc \
src/hb-face.cc \
src/hb-font.cc \
src/hb-ot-tag.cc \
src/hb-ft.cc \
src/hb-set.cc \
src/hb-shape.cc \
src/hb-shape-plan.cc \
src/hb-shaper.cc \
src/hb-tt-font.cc \
src/hb-unicode.cc \
src/hb-warning.cc \
src/hb-ot-layout.cc \
src/hb-ot-map.cc \
src/hb-ot-shape.cc \
src/hb-ot-shape-complex-arabic.cc \
src/hb-ot-shape-complex-default.cc \
src/hb-ot-shape-complex-indic.cc \
src/hb-ot-shape-complex-indic-table.cc \
src/hb-ot-shape-complex-myanmar.cc \
src/hb-ot-shape-complex-sea.cc \
src/hb-ot-shape-complex-thai.cc \
src/hb-ot-shape-normalize.cc \
src/hb-ot-shape-fallback.cc
#############################################################
# build the harfbuzz library
#
#
#include $(CLEAR_VARS)
#
#LOCAL_ARM_MODE := arm
#
#LOCAL_MODULE_TAGS := optional
#
#LOCAL_SRC_FILES:= \
# $(HARFBUZZ_SRC_FILES) \
# src/hb-icu.cc
#
#LOCAL_CPP_EXTENSION := .cc
#
#LOCAL_SHARED_LIBRARIES := \
# libcutils \
# libicuuc \
# libicui18n \
# libutils
#
#LOCAL_C_INCLUDES += \
# $(LOCAL_PATH)/src \
# external/icu4c/common
#
#LOCAL_CFLAGS += -DHB_NO_MT -DHAVE_OT -DHAVE_ICU
#
#LOCAL_LDLIBS += -lpthread
#
#LOCAL_MODULE:= libharfbuzz_ng
#
#include $(BUILD_SHARED_LIBRARY)
#############################################################
# build the harfbuzz static library
#
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:= \
$(HARFBUZZ_SRC_FILES) \
src/hb-ucdn.cc \
src/hb-ucdn/ucdn.c
LOCAL_CPP_EXTENSION := .cc
LOCAL_STATIC_LIBRARIES := libfreetype
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/hb-ucdn \
external/freetype/include
LOCAL_CFLAGS += -DHB_NO_MT -DHAVE_OT -DHAVE_UCDN -DHAVE_FREETYPE
LOCAL_LDLIBS += -lpthread
LOCAL_MODULE:= libharfbuzz
include $(BUILD_STATIC_LIBRARY)
and I have a build.sh file in my jni directory,which will exort my freetype module,quite simple:
export NDK_MODULE_PATH=/home/***/workspace/indic-text-renderer/jni
ndk-build
Besides all this, you will have to cross-compile freetype library.
Wish you good luck, it costs me almost a week.

Android NDK - no type named 'function' in namespace 'std'

I keep getting the following error in the Android NDK when building with Cocos-2dx and Clang
jni/../../Classes/Facebook/FacebookConstants.h:44:14: error: no type named 'function' in namespace 'std'
typedef std::function<void()> FacebookLoginCallback;
TApplication.mk
NDK_TOOLCHAIN_VERSION := clang
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1
Android.mk
LOCAL_CFLAGS :=-D__GXX_EXPERIMENTAL_CXX0X__
LOCAL_CPPFLAGS := -std=c++11
LOCAL_CFLAGS += -std=gnu++11
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := game_shared
LOCAL_MODULE_FILENAME := libgame
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/Facebook/Request.cpp \
../../Classes/FriendListCell.cpp \
../../Classes/Game.cpp \
../../Classes/GameListCell.cpp \
../../Classes/GameListHeaderCell.cpp \
../../Classes/GameScene.cpp \
../../Classes/LoginScene.cpp \
../../Classes/MenuScene.cpp \
../../Classes/NewGameScene.cpp \
../../Classes/Parse/curl/docs/examples/asiohiper.cpp \
../../Classes/Parse/curl/docs/examples/htmltitle.cpp \
../../Classes/Parse/HTTP.cpp \
../../Classes/Parse/lib_json/json_reader.cpp \
../../Classes/Parse/lib_json/json_value.cpp \
../../Classes/Parse/lib_json/json_writer.cpp \
../../Classes/Parse/ParseHTTP.cpp \
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../Classes/Parse \
$(LOCAL_PATH)/../../Classes/Parse/json \
$(LOCAL_PATH)/../../Classes/Parse/lib_json \
$(LOCAL_PATH)/../../Classes/Facebook \
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,CocosDenshion/android) \
$(call import-module,cocos2dx) \
$(call import-module,extensions)
I think You don't have a linker error. You have a compiler error. The problem is, you dont have mention support of C++11 in your application. You have to use the one that comes with Clang by specifying the -std=c++11 compiler flag (APP_CPPFLAGS) in Application.mk file which is in your jni folder. i.e.
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11
Don't forget to include it in the header
#include <functional>
In my project cocos2d-x v3.0.0, this is needed for the Android build but not for iOS. I guess it's included elsewhere.
I have the same problem, and resloved it by doing:
In Android.mk file, add
LOCAL_CPP_EXTENSION += .h

Android jni "No Rule to make Target issue"

I am trying to compile the project which i got from below link .
Github project fmpeg. But while compiling that to create .so files using andriod ndk version 5 i am getting the following issue . Please advice me to solve it .
make: *** No rule to make target `/cygdrive/D/Shakthi/jhotovy/jhotovy-android-ffmpeg-fab1412/Project/jni/ffmpeg/ffmpeg.c', needed by `/cygdrive/D/Shakthi/jhotovy/jhotovy-android-ffmpeg-fab1412/Project/obj/local/armeabi/objs/ffmpeg/ffmpeg/ffmpeg.o'. Stop.
My Android.mk file code.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg
FFMPEG_LIBS := $(addprefix ffmpeg/, \
libavdevice/libavdevice.a \
libavformat/libavformat.a \
libavcodec/libavcodec.a \
libavfilter/libavfilter.a \
libswscale/libswscale.a \
libavutil/libavutil.a \
libpostproc/libpostproc.a )
OGG_LIBS := $(addprefix libogg/output/lib/, \
libogg.a )
VORBIS_LIBS := $(addprefix libvorbis/output/lib/, \
libvorbis.a \
libvorbisenc.a \
libvorbisfile.a )
THEORA_LIBS := $(addprefix libtheora/output/lib/, \
libtheora.a \
libtheoraenc.a \
libtheoradec.a )
LOCAL_CFLAGS += -g -Iffmpeg -Ivideokit -Wno-deprecated-declarations
LOCAL_LDLIBS += -llog -lz $(FFMPEG_LIBS) $(THEORA_LIBS) $(OGG_LIBS) x264/libx264.a
LOCAL_SRC_FILES := ffmpeg_android/ffmpeg_android.c ffmpeg/ffmpeg.c ffmpeg/cmdutils.c
include $(BUILD_SHARED_LIBRARY)
# Use to safely invoke ffmpeg multiple times from the same Activity
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeginvoke
LOCAL_SRC_FILES := ffmpeg_invoke/ffmpeg_invoke.c
LOCAL_LDLIBS := -ldl
include $(BUILD_SHARED_LIBRARY)
Did you follow the instructions in "How to build it"?

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