Could someone please assist with this NDK linker error? Been working at it for hours. NDK bug? - android-ndk

I am trying to compile and link a simple enough program (basically a hello world example) all day long. I've asked the author of the library and he told me to fix my linker dependencies. Here is the relevant info:
I also tried compiling with the author's build tool and linking it as a static library, but to no avail. I have also tried all variations of the STL build environment. Am I doing anything wrong, or is something else the problem?
testbgfx.cpp
#include <SDL.h>
#include <bgfxplatform.h>
#include <bgfx.h>
int main(int argc, char* args[])
{
// SDL_Init( SDL_INIT_EVERYTHING ); Uncommenting this did nothing
SDL_Rect bounds;
SDL_GetDisplayBounds(0,&bounds);
int height = bounds.h;
int width = bounds.w;
SDL_Window* window = SDL_CreateWindow("TestApp",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,width,height,SDL_WINDOW_MAXIMIZED);
bgfx_sdlSetWindow(window);
bgfx::init();
return 0;
}
Android.mk (for client app)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := main
LOCAL_SRC_FILES := testbgfx.cpp
# Switching to static lib did nothing
#LOCAL_STATIC_LIBRARIES := bgfx
LOCAL_SHARED_LIBRARIES := SDL2 bx bgfx
# Required for compilation
LOCAL_CXXFLAGS := $(LOCAL_CFLAGS) -D__STDC_LIMIT_MACRO -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog -lc -ldl -lm -landroid -lEGL
include $(BUILD_SHARED_LIBRARY)
$(call import-module,bx)
$(call import-module,bgfx)
$(call import-module,SDL2)
The Android.mk for the bgfx library (in ndk sources directory, as required)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := bgfx
#This did nothing
#LOCAL_C_INCLUDES += src
#Disabled those to see that would happen - nothing
#LOCAL_CFLAGS := -Wall -Wextra -g -Wa,--noexecstack -no-canonical-prefixes -ffunction-sections -Wno-psabi -Wunused-value -Wundef -fstack-protector
#LOCAL_CXXFLAGS := $(LOCAL_CFLAGS) -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -MMD -MP -fPIC -std=c++0x
LOCAL_SRC_FILES := src
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
#Enabling the following changed nothing
#LOCAL_C_INCLUDES := $(LOCAL_PATH)/3rdparty
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
# This doesn't work
#LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/src/*.h
# Neither does this
#LOCAL_EXPORT_C_INCLUDES += $(wildcard $(LOCAL_PATH)/src/*h)
LOCAL_SHARED_LIBRARIES := bx
LOCAL_EXPORT_SHARED_LIBRARIES := bx
#Switching to static did nothing
#include $(BUILD_STATIC_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
$(call import-modules,bx)
Android.mk for bx (utility lib depended on my bgfx, also in the ndk sources dir)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := bx
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(BUILD_SHARED_LIBRARY)
Here is relevant error log:
/home/noob/android/android-ndk-r10d/toolchains/arm-linux-androideabi- 4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libmain.so -shared --sysroot=/home/noob/android/android-ndk-r10d/platforms/android-18/arch-arm ./obj/local/armeabi-v7a/objs/main/testbgfx.o ./obj/local/armeabi-v7a/libSDL2.a -lgcc ./obj/local/armeabi-v7a/libbx.so ./obj/local/armeabi-v7a/libbgfx.so ./obj/local/armeabi-v7a/libgnustl_shared.so -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -mthumb -L/home/noob/android/android-ndk-r10d/platforms/android-18/arch-arm/usr/lib -lGLESv1_CM -lGLESv2 -llog -lc -ldl -lm -landroid -lEGL -Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit -ldl -lGLESv1_CM -lGLESv2 -llog -landroid /home/noob/android/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libsupc++.a -lc -lm -o ./obj/local/armeabi-v7a/libmain.so
jni/src/testbgfx.cpp:18: error: undefined reference to 'bgfx::init(bgfx::RendererType::Enum, bgfx::CallbackI*, bx::ReallocatorI*)'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libmain.so] Error 1

The Android.mk for bgfx doesn't actually seem to be listing any source files to compile - you've only listed LOCAL_SRC_FILES := src which seems to be a directory. You need to list all the individual C/C++ source files here.

Related

Android ndk /i686-linux-android/bin\ld: warning: shared library text segment is not shareable

i'm trying to run my android studio(kotlin) project, but there is a problem when ndk build, like this:
> Task :libuvccamera:ndkBuild
> Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 1 in ./AndroidManifest.xml. NDK binaries will *not* be comptible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
> make: Entering directory `C:/Users/Hamzah/AndroidStudioProjects/camera-bts-detector-master/camera-bts-detector-master/libuvccamera/src/main'
> [x86] SharedLibrary : libjpeg-turbo1500.so
> [armeabi-v7a] SharedLibrary : libuvc.so
> [armeabi-v7a] Install : libjpeg-turbo1500.so => libs/armeabi-v7a/libjpeg-turbo1500.so
> [armeabi-v7a] Install : libusb100.so => libs/armeabi-v7a/libusb100.so
> [x86] Install : libusb100.so => libs/x86/libusb100.so
> C:/Users/Hamzah/AppData/Local/Android/Sdk/ndk/16.1.4479499/build//../toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: warning: shared library text segment is not shareable
> C:/Users/Hamzah/AppData/Local/Android/Sdk/ndk/24.0.8215888/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/fortify/stdio.h:73: error: undefined reference to '__vsprintf_chk'
> clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
> C:/Users/Hamzah/AppData/Local/Android/Sdk/ndk/24.0.8215888/build//../toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include\bits/fortify/stdio.h:73: error: undefined reference to '__vsprintf_chk'
> clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
> make: *** [obj/local/armeabi-v7a/libuvc.so] Error 1
> make: *** Waiting for unfinished jobs....
> make: *** [obj/local/x86/libjpeg-turbo1500.so] Error 1
> make: Leaving directory `C:/Users/Hamzah/AndroidStudioProjects/camera-bts-detector-master/camera-bts-detector-master/libuvccamera/src/main'
> Task :libuvccamera:ndkBuild FAILED
Execution failed for task ':libuvccamera:ndkBuild'.
> Process 'command 'C:\Users\Hamzah\AppData\Local\Android\Sdk\ndk\16.1.4479499/ndk-build.cmd'' finished with non-zero exit value 2
and this is my AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.serenegiant.uvccamera"
android:versionCode="2"
android:versionName="1.1" >
this is local.properties:
sdk.dir=C\:\\Users\\Hamzah\\AppData\\Local\\Android\\Sdk
ndk.dir=C\:\\Users\\Hamzah\\AppData\\Local\\Android\\Sdk\\ndk\\16.1.4479499
this is Android.mk:
######################################################################
# Make shared library libUVCCamera.so
######################################################################
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
######################################################################
# Make shared library libUVCCamera.so
######################################################################
CFLAGS := -Werror
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/ \
$(LOCAL_PATH)/../ \
$(LOCAL_PATH)/../rapidjson/include \
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%)
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_CFLAGS += -DLOG_NDEBUG
LOCAL_CFLAGS += -DACCESS_RAW_DESCRIPTORS
LOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl
LOCAL_LDLIBS += -llog
LOCAL_LDLIBS += -landroid
LOCAL_SHARED_LIBRARIES += usb100 uvc
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES := \
_onload.cpp \
utilbase.cpp \
UVCCamera.cpp \
UVCPreview.cpp \
UVCButtonCallback.cpp \
UVCStatusCallback.cpp \
Parameters.cpp \
serenegiant_usb_UVCCamera.cpp
LOCAL_MODULE := UVCCamera
include $(BUILD_SHARED_LIBRARY)
I've tried NDK version 16 and 17, the result is as above.
I've also tried NDK version 18-24, the result is like:
Android NDK: android-14 is unsupported. Using minimum supported version android-16
Android NDK: WARNING: APP_PLATFORM android-16 is higher than android:minSdkVersion 1 in ./AndroidManifest.xml.
any suggestions for me?
sorry i'm a beginner,
all answers i appreciate

ndk-bulid problem with bulit file Macintosh (CR) and Unix (LF)

I'm trying to build my native library (C++) but I always end up with output file as Macintosh (CR) and not Unix (LF)
here's my files:
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := test1
LOCAL_SRC_FILES := hellocode.cpp
LOCAL_CPPFLAGS := -std=gnu++0x -Wall -fPIE
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -fPIE -pie
include $(BUILD_EXECUTABLE)
Application.mk
APP_STL := c++_static
APP_ABI := arm64-v8a armeabi-v7a x86 x86_64
APP_PLATFORM := android-21
APP_OPTIM := release
APP_CPPFLAGS := -std=c++14 -fno-rtti -fno-exceptions -DNDEBUG -Wall -fpermissive -fpic
APP_LDFLAGS := -llog
APP_THIN_ARCHIVE := true
APP_PIE := true
Bulid.bat:
"C:\Users\UserOne\AppData\Local\Android\Sdk\ndk\21.0.6113669\ndk-build"
Output file must be Unix(LF) otherwise it won't work, How I can fix it?

Integers are formatted incorrectly when cross-compiling to armv5te

When compiling the following program on my computer, it outputs the expected value:
fn main() {
let number = 42;
println!("number is {}", number);
}
number is 42
When cross-compiled for armv5te and run on the target, it outputs the following result:
number is 14
I believe that the implementation of Display for i32 is not working as expected. In particular, it seems that the characters printed are taken at the wrong index in the following array (found in libcore/fmt/num.rs):
const DEC_DIGITS_LUT: &'static[u8] =
b"0001020304050607080910111213141516171819\
2021222324252627282930313233343536373839\
4041424344454647484950515253545556575859\
6061626364656667686970717273747576777879\
8081828384858687888990919293949596979899";
The two digits displayed are taken on the table at an offset of 1 byte to the left compared with the right place. I verified this hypothesis by testing with some other numbers (10 -> 91, 11 -> 01 for instance).
Other formats ({:b}, {:o}, {:x}) all give the expected result on my computer and on the target.
I am using a self compiled version of Rust (1.13.0, 2c6933acc 2016-11-07) for the successful test on my computer and the unsuccessful one on my ARM device. Here is the diff of the modifications I had to do:
diff --git a/mk/cfg/arm-unknown-linux-gnueabi.mk b/mk/cfg/arm-unknown-linux-gnueabi.mk
index f66ad04..b9e4157 100644
--- a/mk/cfg/arm-unknown-linux-gnueabi.mk
+++ b/mk/cfg/arm-unknown-linux-gnueabi.mk
## -1,5 +1,5 ##
# arm-unknown-linux-gnueabi configuration
-CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-linux-gnueabi-
+CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-unknown-linux-uclibcgnueabi-
CC_arm-unknown-linux-gnueabi=gcc
CXX_arm-unknown-linux-gnueabi=g++
CPP_arm-unknown-linux-gnueabi=gcc -E
## -8,8 +8,8 ## CFG_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).so
CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).a
CFG_LIB_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -Darm -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -Darm -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
+CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -Darm -mfloat-abi=soft $(CFLAGS) -fno-stack-protector -march=armv5te -mtune=arm926ej-s
+CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -Darm -mfloat-abi=soft $(CFLAGS) -fno-stack-protector -march=armv5te -mtune=arm926ej-s
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
diff --git a/src/librustc_back/target/arm_unknown_linux_gnueabi.rs b/src/librustc_back/target/arm_unknown_linux_gnueabi.rs
index e666a84..8af2596 100644
--- a/src/librustc_back/target/arm_unknown_linux_gnueabi.rs
+++ b/src/librustc_back/target/arm_unknown_linux_gnueabi.rs
## -24,7 +24,7 ## pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(),
options: TargetOptions {
- features: "+v6".to_string(),
+ features: "+v5te".to_string(),
.. base
},
})
I finally found a solution to this problem!
The problem was that LLVM was not properly configured and was generating code performing unaligned accesses. To fix this, I added the strict-align feature flag in src/librustc_back/target/arm_unknown_linux_gnueabi.rs
Here is the final diff with all the modifications I had to do:
diff --git a/mk/cfg/arm-unknown-linux-gnueabi.mk b/mk/cfg/arm-unknown-linux-gnueabi.mk
index f66ad04..b9e4157 100644
--- a/mk/cfg/arm-unknown-linux-gnueabi.mk
+++ b/mk/cfg/arm-unknown-linux-gnueabi.mk
## -1,5 +1,5 ##
# arm-unknown-linux-gnueabi configuration
-CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-linux-gnueabi-
+CROSS_PREFIX_arm-unknown-linux-gnueabi=arm-unknown-linux-uclibcgnueabi-
CC_arm-unknown-linux-gnueabi=gcc
CXX_arm-unknown-linux-gnueabi=g++
CPP_arm-unknown-linux-gnueabi=gcc -E
## -8,8 +8,8 ## CFG_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).so
CFG_STATIC_LIB_NAME_arm-unknown-linux-gnueabi=lib$(1).a
CFG_LIB_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabi=lib$(1)-*.dylib.dSYM
-CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
-CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -march=armv6 -marm
+CFG_JEMALLOC_CFLAGS_arm-unknown-linux-gnueabi := -D__arm__ -mfloat-abi=soft $(CFLAGS) -fno-stack-protector -march=armv5te -mtune=arm926ej-s
+CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabi := -Wall -g -fPIC -D__arm__ -mfloat-abi=soft $(CFLAGS) -fno-stack-protector -march=armv5te -mtune=arm926ej-s
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabi := -fno-rtti $(CXXFLAGS)
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabi := -shared -fPIC -g
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-list=
diff --git a/src/librustc_back/target/arm_unknown_linux_gnueabi.rs b/src/librustc_back/target/arm_unknown_linux_gnueabi.rs
index e666a84..551bba0 100644
--- a/src/librustc_back/target/arm_unknown_linux_gnueabi.rs
+++ b/src/librustc_back/target/arm_unknown_linux_gnueabi.rs
## -24,7 +24,7 ## pub fn target() -> TargetResult {
target_vendor: "unknown".to_string(),
options: TargetOptions {
- features: "+v6".to_string(),
+ features: "+v5te,+strict-align".to_string(),
.. base
},
})

Module verification failed when insmod a module

On Ubuntu 14.04, Kernel 3.13.0, When I insert below simple module, I got error message from kernel log:
"module verification failed: signature and/or required key missing - tainting kernel"
Did I made any mistake or missed anything?
Here is module source code in a file named ts2.c.
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h>
MODULE_LICENSE("GPL");
MODULE_ALIAS("hello2");
static int __init hello1_init(void)
{
printk(KERN_INFO "Hello world 2.\n");
return 0;
}
static void __exit hello1_exit(void)
{
printk(KERN_INFO "Goodbye world 2.\n");
}
module_init(hello1_init);
module_exit(hello1_exit);
Here is the Makefile:
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)
ifneq ($(KERNELRELEASE),)
obj-m := ts2.o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD) clean
endif
depend .depend dep:
$(CC) $(EXTRA_CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
You have a problem in your make file...
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)
ifneq ($(KERNELRELEASE),)
obj-m := ts2.o
Rather it should be as below:
ifeq ($(DEBUG),y)
DEBFLAGS = -O -g -DPCI_INFO_DEBUG # "-O" is needed to expand inlines
else
DEBFLAGS = -O2
endif
EXTRA_CFLAGS += $(DEBFLAGS) -I$(LDDINC)
ifneq ($(KERNELRELEASE),)
obj-m := hello1.o
Now your issues should be solved

ndk-build failed to build PocketSphinxAndroidDemo project

I am trying to use "android-ndk-r5b" to build PocketSphinx for Android.
I downloaded PocketSphinxAndroidDemo project from "https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/PocketSphinxAndroidDemo" alone with "pocketsphinx" and "sphinxbase" projects.
I am on Windows 7 and using Cygwin to run "ndk-build" the problem is all static libraries (.a file) are generated but unable to create the .so file due to the following reference error:
$ /cygdrive/c/android-ndk-r5b/ndk-build
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
SharedLibrary : libpocketsphinx_jni.so
C:/eclipse/workspace/PocketSphinxAndroidDemo/obj/local/armeabi/libpocketsphinx.a
(pocketsphinx.o): In function `ps_reinit':
C:/eclipse/workspace/pocketsphinx/src/libpocketsphinx/pocketsphinx.c:228: undefi
ned reference to `logmath_get_base'
C:/eclipse/workspace/pocketsphinx/src/libpocketsphinx/pocketsphinx.c:231: undefi
ned reference to `logmath_free'
C:/eclipse/workspace/pocketsphinx/src/libpocketsphinx/pocketsphinx.c:232: undefi
ned reference to `logmath_init'
C:/eclipse/workspace/pocketsphinx/src/libpocketsphinx/pocketsphinx.c:293: undefi
ned reference to `ptmr_init'
C:/eclipse/workspace/PocketSphinxAndroidDemo/obj/local/armeabi/libpocketsphinx.a
(pocketsphinx.o): In function `ps_free':
C:/eclipse/workspace/pocketsphinx/src/libpocketsphinx/pocketsphinx.c:340: undefi
ned reference to `logmath_free'
C:/eclipse/workspace/PocketSphinxAndroidDemo/obj/local/armeabi/libpocketsphinx.a
(pocketsphinx.o): In function `ps_update_lmset':
C:/eclipse/workspace/pocketsphinx/src/libpocketsphinx/pocketsphinx.c:413: undefi
ned reference to `ngram_model_free'
C:/eclipse/workspace/PocketSphinxAndroidDemo/obj/local/armeabi/libpocketsphinx.a
(pocketsphinx.o): In function `ps_add_word':
C:/eclipse/workspace/pocketsphinx/src/libpocketsphinx/pocketsphinx.c:565: undefi
ned reference to `ngram_model_add_word'
All the header file paths are specified. No problem to create static libraries but has problem to link static libraries to create shared library.
Here is my "Android.mk" file:
# 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 := $(HOME)/Projects/Sphinx/trunk
SPHINX_PATH := /cygdrive/c/eclipse/workspace
# 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_EXPORT_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 $(SPHINX_PATH)/pocketsphinx/src/libpocketsphinx \
$(SPHINX_PATH)/pocketsphinx/src/gst-plugin $(SPHINX_PATH)/sphinxbase/include/sphinxbase
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 $(SPHINX_PATH)/pocketsphinx/src/libpocketsphinx
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK
LOCAL_PATH := $(BASE_PATH)
LOCAL_MODULE := pocketsphinx_jni
LOCAL_SRC_FILES := pocketsphinx_wrap.c
# See http://code.google.com/p/android/issues/detail?id=9439
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)
=====================================================================
Thank you in advance for any suggestions!
gwofu
Reverse your LOCAL_STATIC_LIBRARIES Sequence is ok
To expand on user642960's response, I changed the LOCAL_STATIC_LIBRARIES line within Android.mk to:
LOCAL_STATIC_LIBRARIES := pocketsphinx sphinxlm sphinxfeat sphinxfe sphinxutil
After doing so, the errors that the submitter is describing went away for me. I also upgraded NDK, but that didn't seem to fix things on its own.

Resources