Ask Your Question

hidden symbol '__aeabi_atexit' in ... is referenced by DSO ...

asked 2013-06-07 18:27:16 -0500

Creat gravatar image

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  :
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
Install        : => libs/armeabi-v7a/

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

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/ 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):

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include $(OPENCV_ANDROID)sdk/native/jni/

LOCAL_MODULE    := CamAnalysis
LOCAL_SRC_FILES := CamAnalysis.cpp


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

Thank you for any help!

edit retag flag offensive close merge delete


I too am experiencing this. Any help would be welcomed!

Oliver Wilkie gravatar imageOliver Wilkie ( 2013-09-08 05:03:45 -0500 )edit

You were able to find where is the problem?

Julio Nogueira gravatar imageJulio Nogueira ( 2014-03-31 08:45:28 -0500 )edit

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

Creat gravatar imageCreat ( 2014-05-29 17:10:01 -0500 )edit

The " before Compile++ thumb is a cosmetic bug in NDK specific to Windows, it is caused by difference in echo behavior in Windows and POSIX systems.

Alex Cohn gravatar imageAlex Cohn ( 2014-06-16 02:01:56 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-29 17:34:11 -0500

Creat gravatar image

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

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

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!

edit flag offensive delete link more


I believe it is OK to use gnustl_static, or any other STL, or not use STL at all in your app that uses The reason is that no OpenCV external interfaces use STL, and all STL dependencies are terminated inside libopencv_java. The quoted NDK document refers to the situation when STL objects are shared between binaries (e.g. exposes to a method that returns std::string).

Alex Cohn gravatar imageAlex Cohn ( 2014-06-16 02:12:00 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-06-07 18:27:16 -0500

Seen: 16,809 times

Last updated: May 29 '14