I'm trying to debug some native Android code built through the NDK. Unfortunately, when I launch the process under the debugger from Eclipse I get an error
I'm sorry, Dave, I can't do that. Symbol format `elf32-littlearm' unknown.
The code is compiled for ARM thumb so the symbol format makes sense. However, using Google's bundled ADT for Eclipse should work? Do I need to specify a specific version of GDB to use?
To note, the code runs fine without trying to debug.
I'm running on Windows 7 64 bit with NDK release 10.
After some searching it looks like it is a bug with the GDB shipped with the NDK r10 toolchain. See https://code.google.com/p/android/issues/detail?id=74371. The download linked from that bug seems to work for me.
Related
I'm working on an app for android which has to display pdf files without using external viewers. For various reasons, the app is developed using qml/qt on windows 10 with the qt creator.
I found two possible solutions for my problem:
QtPDF would be perfect. Sadly, it isn't supported for android which has been confirmed by Qt's support team. The priority for adding android is quite low so no hoping that it will be usable in the near future (see here)
Poppler (especially the poppler-qml-plugin found here). Seems to do what is needed only I have had no success in building it. I tried finding a cross-compiling solution as I suppose I will need to use the android compiler...
I have little experience in using qt creator and especially in developing on this setup for android. Would be great if anyone has already worked with a configuration like that and could help me!
My Setup:
Windows 10
Qt 5.15.2
Qt Creator 4.14.0
Android NDK 21.3.6528147
Target ABIs are
x86 (AVD)
armeabi-v7a
arm64-v8a
EDIT
I decided to follow the "poppler approach".
What I did so far:
I got the poppler source code and attempted a first build. CMake couldn't find Freetype, so I got it's source, build it and fed it to CMake. Then I had to do the same for JPEG (I assume this is openjpeg2), ZLIB, PNG and TIFF. zlib, png and tiff are accepted, though CMake throws an error regarding JPEG: "ooops"
precisely: "CMake Error at [...]/3rdParty/openjpeg/build-openjpeg-2.4.0-Desktop_Qt_5_15_2_MSVC2019_64bit-Release/OpenJPEGConfig.cmake:41 (message): ooops Call Stack (most recent call first): CMakeLists.txt:251 (find_package)"
and additionally, Cairo and Boost could not be found. So my question at this point is: am I doing this right? Is it the correct approach to find out one by one what other libs I have to build? Or am I missing something? Because I got to admit, I'm quite lost and don't really know what I'm doing...
I want to make DSP calculations by native code. This works well within the emulator (Android 4.2.2). But on several devices (Android 7 and 9) the lib built by the NDK let the app crash directly on executing System.loadLibrary. But: a downloaded lib loads without problems when I put it into my APK.
I confess, for the main app I am using an old Eclipse IDE on Windows, targeting for API 26. My NDK is a small r7, running on Ubuntu. But my lib only makes calculations on byte arrays in standard c, no Android things are accessed here.
The native code compiles free of warnings and errors and is built for armeabi and armeabi-v7a. In the APK the libxyz.so files are in the correct folders. The names of the export functions should be correct. But even if there are no declarations for them in the Java class and nothing native is called, the crash directly occurs on static { System.loadLibrary("libxyz.so"); }
Can my lib binaries be incompatible?
Thanks for any help!
Update: The libs indeed were incompatible, see comments below.
Finally I could read the logcat from a device (by command line adb, in Eclipse this was not working). The problem seems to be caused by "text relocations" in the binaries.
Logcat: "java.lang.UnsatisfiedLinkError ... dlopen failed ... libxyz.so has text relocations"
Updating to a newer NDK (9) fixed the TEXTREL bug. Now System.loadLibrary and calling the native methods works on newer APIs. So I had to install 1,4 GB of NDK for calculating things in standard c.
I am trying to integrate Boost.Log in a QT/QML project that has to work on Windows, Linux and Android. While Win32 and Linux versions work like a charm, Android is giving me a few headaches.
I was able to build Boost library following instructions at https://github.com/moritz-wundke/Boost-for-Android.
However,
If I link my application statically to boost libraries, I get a bunch of linker errors, complaining that symbols are not found. Error messages are like: "error: undefined reference to 'boost::log::v2_mt_posix::core::get()', I get ~60 of them and I checked many times the file paths
If I link dynamically to boost, I can successfully generate my APK (the relevant .so files are included) but it crashes upon startup, both on a real device and on Android emulator
I'm new to Android development so it's entirely possible that I'm missing some key step here and I'm not really sure on what information may be relevant to provide here. Hope that someone can help.
I tried building with both ndk 20 and 21, Boost 1.70, Android SDK 26.
I plan to use QT 5.12 but did not add any QT code yet. I used QT Creator 4.10.2 (Windows) and 4.11.1 (Linux)
To convert a native Android .apk to a Blackberry .bar does not seem to be a problem.
However, I have an Android .apk (API 15) that I implemented using Xamarin. I am able to convert the file to a .bar file using the BB10 Sideloading Tool, but when I run the app on the Blackberry simulator, I get the error messages:
android_update_LD_LIBRARY_PATH not found; .so dependencies will not work
and later
FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError: Library cannot be found at java.lang.Runtime.loadLibrary(Runtime.java:361)
etc...
I am not really sure what steps can fix this errors.
Is it basically possible to run Xamarin-created .apk-files on Blackberry?
Would it maybe help to turn on the switch "Bundle assemblies into native code" in the Android Build options? For this, I would have to upgrade to Enterprise, but if it helps...
Correct me if I'm wrong, but I'm pretty sure Xamarin works with building your code as a native (as in NDK) library for Android, and a small Java glue to load and run the code from this library.
Two things to note here: the simulator runs a x86 instruction set, when your library is probably built for ARM. Won't work.
For a real device, you'll have to check that every library needed by yours is present on a BB10 device, which is not guaranteed as far as I understand: http://developer.blackberry.com/android/apisupport/android_native_support.html
I've built the gdb 7.4.1 for Android (applied Android patches from ndk-r8 and configured it for arm-linux-androideabi). It works fine on some devices, but on some other it refuses to set breakpoints reporting "cannot access memory".
I used the original gdbserver from the NDK assuming that the protocol is compatible.
Has anyone run into similar problems? Do I need to build the gdbserver from 7.4.1 sources as well? Or am I missing some external patches?
Just solved it. Apparently, the gdbserver provided with Android NDK r8 is not fully compatible with gdb 7.4.1. Building gdbserver from sources and replacing the NDK one solves the problem completely.