I am working on an android POS device running on version 4.2.2 i need to make use of the serialPort api to communicate with the printer i have configured the gradle to create the libs folder zipped with the generated .apk file
02-25 10:18:59.956 29180-29180/com.amedora.slrtcpos E/linker: load_library(linker.cpp:771): too small to be an ELF executable: /data/app-lib/com.amedora.slrtcpos-1/libserial_port.so
02-25 10:18:59.956 29180-29180/com.amedora.slrtcpos E/dalvikvm: dlopen("/data/app-lib/com.amedora.slrtcpos-1/libserial_port.so") failed: Cannot load library: load_library(linker.cpp:771): too small to be an ELF executable: /data/app-lib/com.amedora.slrtcpos-1/libserial_port.so
02-25 10:18:59.970 29180-29180/com.amedora.slrtcpos E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Cannot load library: load_library(linker.cpp:771): too small to be an ELF executable: /data/app-lib/com.amedora.slrtcpos-1/libserial_port.so
I need help can someone tell me why it is saying too small to be an ELF executable
too small to be an ELF executable: /data/app-lib/com.amedora.slrtcpos-1/libserial_port.so
means that you have a zero-length file with above path.
Related
I was trying to add some __android_log_print in Tensorflow Lite source code. I use the following command to generate Tensorflow Lite library (libtensorflowlite.jar and libtensorflowlite_jni.so).
bazel build -c opt --cxxopt='--std=c++11' //tensorflow/contrib/lite/java:tensorflowlite \
--crosstool_top=//external:android/crosstool \
--host_crosstool_top=#bazel_tools//tools/cpp:toolchain \
--cpu=armeabi-v7a
I used those two files (.jar and .so) for TFLiteCameraDemo app, which was built via Android Studio.
However, when I opened the app on my android device (Android 7.1), it showed the following errors.
02-18 16:36:35.990 25543-25543/android.example.com.tflitecamerademo W/System.err: TensorFlowLite: failed to load native library: dlopen failed: cannot locate symbol "__android_log_print" referenced by "/data/app/android.example.com.tflitecamerademo-1/lib/arm/libtensorflowlite_jni.so"...
02-18 16:36:35.992 25543-25543/android.example.com.tflitecamerademo W/System.err: TensorFlowLite: failed to load native library: dlopen failed: cannot locate symbol "__android_log_print" referenced by "/data/app/android.example.com.tflitecamerademo-1/lib/arm/libtensorflowlite_jni.so"...
02-18 16:36:35.992 25543-25543/android.example.com.tflitecamerademo E/art: No implementation found for long org.tensorflow.lite.NativeInterpreterWrapper.createErrorReporter(int) (tried Java_org_tensorflow_lite_NativeInterpreterWrapper_createErrorReporter and Java_org_tensorflow_lite_NativeInterpreterWrapper_createErrorReporter__I)
02-18 16:36:35.992 25543-25543/android.example.com.tflitecamerademo D/AndroidRuntime: Shutting down VM
By the way, I have already included these lines in my build.gradle.
ndk {
abiFilters "${cpuType}"
ldLibs "log"
}
The NDK version I use is r14b.
Is there any solution to this problem?
ndk.ldLibs relates to deprecated NDK plugin. These days, we use different Android Studio integration syntax.
At any rate, bazel silently ignores this.
You can pass -llog to bazel via --linkopt flag:
bazel build -c opt --cxxopt='--std=c++11' --linkopt='-llog' …
BTW, if I am not missing something, you should use --android_cpu instead of --cpu, but you can just as well skip it, because armeabi-v7a is the default for --android_cpu.
I'm trying to build the SoundTouch library for Android, by following the guide provided within the source code:
Compiling
To compile the SoundTouch library source codes into an Android native
library, open Cygwin/bash shell, go to directory
"soundtouch/source/Android-lib/jni" and invoke the NDK compiler with
following command:
$NDK/ndk-build
This will build binaries for all the supported Android platforms
(arm-v5, arm-v7, X86, MIPS etc) of SoundTouch library, plus the JNI
wrapper interface as discussed below. The target binaries will be
built into the "libs" subdirectory. As long as all these .so binary
library versions are included in the APK Application delivery package,
the targer Android device can choose the correct library version to
use.
Notice that to allow Cygwin/bash to locate the NDK compile scripts,
you need to define the location of the NDK installation defined in
environment variable "NDK". That's easiest done by adding the NDK path
definition at end of your ~/.bash_profile file, for instance as
follows:
NDK=/cygdrive/d/Android/android-ndk-r6
to do this I go into Terminal in the SoundTouch/source/android-lib/jni directory and type the following commands:
export ANDROID_NDK=~/Android/Sdk/ndk-bundle
export NDK_ROOT=$ANDROID_NDK
export PATH=${PATH}:${ANDROID_NDK}
ndk-build
Then I get the following error:
[arm64-v8a] Compile++ : soundtouch <= soundtouch-jni.cpp
jni/soundtouch-jni.cpp:23:10: fatal error: '../source/SoundStretch/WavFile.h'
file not found
#include "../source/SoundStretch/WavFile.h"
^
1 error generated.
/home/daniele/Android/Sdk/ndk-bundle/build/core/build-binary.mk:499: recipe for target 'obj/local/arm64-v8a/objs/soundtouch/soundtouch-jni.o' failed
make: *** [obj/local/arm64-v8a/objs/soundtouch/soundtouch-jni.o] Error 1
If I go to that directory the file is there though. Here is a screenshot of the file with it's direcotry:
Full name is
_ZNSt15basic_streambufIcSt11char_traitsIcEE7seekposESt4fposI9mbstate_tESt13_Ios_Openmode
and it is a weak symbol in libgnustl_shared.so library that resides in Android NDK 10.5.0, e.g., for gcc 4.9 for armeabi-v7a, in directory
sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/
. I get a start up error on the device:
W System.err: Caused by: java.lang.UnsatisfiedLinkError: dlopen
failed: cannot locate symbol ...
even though the library seems to contains weak default definition for it...
I'm trying to compile a Android Kernel from source and I have downloaded all the right packages to do it but for some reason I get this error:
arm-linux-androideabi-gcc: error: unrecognized command line option '-mgeneral-regs-only'
/home/livlogik/android/kernel/H901BK_L_Kernel/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:858: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
I have the latest NDK and I'm using Ubuntu 15.10 64bit if this helps.
Here is where I have the NDK and kernel:
NDK ---- /home/livlogik/android/ndk/
Kernel ---- /home/livlogik/android/kernel/H901bk_L_Kernel/
If someone could help me that would be great. Sorry if this was already posted I could find a answer to it.
Thanks,
Zach
As it can be seen from build error message:
drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c:20:27: fatal error: ./mh1/msm_mh1.h: No such file or directory
#include <./mh1/msm_mh1.h>
compiler just can't find msm_mh1.h file. This is because the path specified for #include directive isn't correct. Most probably it's typo: instead ./ there should be ../.
To fix that error, in drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c file change this line:
#include <./mh1/msm_mh1.h>
to this line
#include "../mh1/msm_mh1.h"
After this make command should work fine. Also, kernel image file will be available at arch/arm64/boot, and it's not zImage as stated in documentation, it's actually Image.gz. Uncompressed kernel image is Image file.
Update
Answering your question in comments:
Is there any way to make it compress into a zImage?
From Documentation/arm64/booting.txt:
The AArch64 kernel does not currently provide a decompressor and
therefore requires decompression (gzip etc.) to be performed by the boot
loader if a compressed Image target (e.g. Image.gz) is used. For
bootloaders that do not implement this requirement, the uncompressed
Image target is available instead.
Basically zImage is just gzipped and self-extracted Image. So zImage file consists of program for unpacking gzip archive in the beginning, followed by gzipped Image, and when kernel is run by bootloader its unpacking itself (hense "self-extracted" term) and then start running.
...So I can make it flashable
In case of arm64, you don't have zImage, so most likely you need to use Image file (which acts in the same way, but only its size is bigger). You can create boot.img from Image file and built AFS ramdisk (using mkbootimg tool) and then just do fastboot flash boot boot.img. Refer to this documentation for example. Of course for your platform some things can be different, so try to find instructions for your platform.
You have to install the right toolchain:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
And configure the Makefile appropriately
The wrong toolchain is at
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-android-4.9
I'm trying to rebuild Limbo Android. I'm on Linux Mint.
All I changed was android-config.mak NDK_ROOT, exported variables NDK_ROOT. I've also exported NDK_MODULE_PATH to /home/pathtoandroidndk/sources, as per README instructions.
From terminal I do cd limbo-android/jni and then make.
Building returns this error:
jni/glib/glib/./libcharset/localcharset.c:22:20: fatal error: config.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi-v7a/objs-debug/glib-2.0/./libcharset/localcharset.o] Error 1
make: Leaving directory `/home/me/limbo-android'
I've tried modifing Android.mk following instructions from Android NDK - Additional Include Directories and Unable to find header files - Android NDK, without success.
I came to conclusion that each module inside limbo-android needs it's own config.h file, while libcharset does not have one.
How do I solve this error? Is there a generic config.h (the one from NDK maybe?)
NOTE: I can build it without any problems on Windows 8.1 using mingw.