Ask Your Question

Creat's profile - activity

2016-01-22 01:52:55 -0500 received badge  Famous Question (source)
2015-07-02 11:11:18 -0500 received badge  Necromancer (source)
2015-07-02 11:11:18 -0500 received badge  Self-Learner (source)
2015-07-02 11:06:24 -0500 received badge  Notable Question (source)
2014-10-06 03:06:00 -0500 received badge  Popular Question (source)
2014-05-29 17:34:11 -0500 answered a question hidden symbol '__aeabi_atexit' in ... is referenced by DSO ...

Apparently this stems from wrong information in the documentation as to how to setup the jni part of an application that also wants to access OpenCV from it's native library. The problem is this line in Application.mk:

APP_STL := gnustl_static

This needs to be gnustl_shared instead, and you need to do a System.loadLibrary("gnustl_shared"); once in your app before invoking OpenCV Manager to load OpenCV. This loads the shared library version of the GNU STL (instead of compiling it into your own lib).

Today I've come across this post on stackoverflow explaining the cause. After reading that the pieces finally fell into place. Both my own library and OpenCV use the gnustl, and opencv was apparently (and correctly!) compiled against the dynamic version.

This is even necessary, and clearly explained in the NDK documentation IN CAPS TEXT to make sure it's not ignored:

Please keep in mind that the static library variant of a given C++ runtime
SHALL ONLY BE LINKED INTO A SINGLE BINARY for optimal conditions.

It goes into more detail why, but the point is we have multiple binaries: we have libopencv_java, which is loaded by the manager, and libyourstuff (libCamAnalysis in my case) containing whatever you have in your own library (containing your own native code). Linking statically with the gnustl is therefore a very very bad idea as the global state might exist twice in one application and can cause memory corruption and all sorts of other nasty stuff.

Unfortunately, the official tutorial on how to create an OpenCV Android app with an own native part (Section "Native/C++") instructs the user to set APP_STL to gnustl_static. I hope this is fixed soon!

2014-05-29 17:10:01 -0500 commented question hidden symbol '__aeabi_atexit' in ... is referenced by DSO ...

I wasn't until just now, see my own answer below.

2013-11-09 11:47:53 -0500 answered a question How can I make Android Native Camera go faster?

I may not have a direct solution, but I might be able to point you in the right direction.

I'm also developing an app for Andriod using OpenCV, and I was mainly using my own Galaxy S2. I get the full 30 fps (with appropriate lighting conditions) when using either my own app or the tutorial app (native or java mode). With the Nexus 4 I recently got to help with development, I get only 10 at best, but after a bit of searching I've found a workaround: According to this StackOverflow post a possible workaround is to set the recording hint to true. This obviously only works with the java version, but after this change I get smooth frame rates (as far as the lighting allows it, so usually also around 30 fps).

One of the problems with this is that this works perfectly on the Nexus 4, but the SGS2 apparently can't deliver frames in NV12 format with the recording hint set and (force-) changes format. I can only hope that this will be fixed at some point in the Nexus 4, as this is a temporary workaround at best...

2013-10-02 10:02:19 -0500 received badge  Student (source)
2013-07-22 08:19:31 -0500 received badge  Critic (source)
2013-06-07 18:27:16 -0500 asked a question hidden symbol '__aeabi_atexit' in ... is referenced by DSO ...

Hello everyone!

I'm getting the following linker warning when calling ndk-build for every (full, i.e. non-incremental) compile of android projects that are using OpenCV. I'm on Win7 x64, with Eclipse and ndk-r8e. This happens both in Eclipse and on the command line.

"E:\\Programming\\Libraries\\android-ndk-r8e\\ndk-build.cmd" all 
Gdbserver      : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserver
Gdbsetup       : libs/armeabi-v7a/gdb.setup
"Compile++ thumb : CamAnalysis <= CamAnalysis.cpp
SharedLibrary  : libCamAnalysis.so
E:/Programming/Libraries/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/
windows-x86_64/arm-linux-androideabi/bin/ld.exe:
warning: hidden symbol '__aeabi_atexit' in E:/Programming/Libraries/android-ndk-r8e/sources/
cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO
E:/Programming\Libraries\OpenCV-2.4.5-android-sdk\sdk/native/libs/armeabi-v7a/libopencv_java.so
Install        : libCamAnalysis.so => libs/armeabi-v7a/libCamAnalysis.so

just for readability: the warning message without the absolute paths

ld.exe: warning: hidden symbol '__aeabi_atexit' in
libgnustl_static.a(atexit_arm.o) is referenced by DSO libopencv_java.so

Everything seems to work fine as far as I can tell, but so far I haven't even managed to find out if this might become a serious problem or can safely be ignored. This happens with every Android project containing OpenCV and native code, including the samples like "tutorial 2 mixed processing" and "face-detection". Obviously, if I change the corresponding APP_ABI inf jni/Application.mk to "armeabi" the warning is gone. Likewise, switching to static linking with "OPENCV_LIB_TYPE:=STATIC" also seems to get rid of the warning.

Please also note the additional double quotes in that message in front of Compile++ (which is also always included in the output and not a copy-paste-error on my part). I know it's likely unrelated and just a small script display/output issue, but I thought I'd mention it...

Anyone have any idea of how to fix this, like with a compiler/linker flag or something? Maybe I've got a problem in my libopencv_java library somehow? Could it be related to some order in which includes are listed? I've also fond this unanswered question relating to the same problem. Generally, whatever I try to google about this or similar warnings mostly leads to people either asking about this warning or unrelated questions that happens to contain this warning (like this or this).

Also for completeness sake, here are my JNI related files (but as I said happens with the samples as well):

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include $(OPENCV_ANDROID)sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := CamAnalysis
LOCAL_SRC_FILES := CamAnalysis.cpp
LOCAL_LDLIBS += -llog

include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-11

Thank you for any help!

2013-06-07 17:24:06 -0500 received badge  Supporter (source)