Ask Your Question

Revision history [back]

How could I get rid of linking error with built static opencv lib on Android building environment?

Hi, Sir: We apply opencv2.1 to be our image algorithm lib base. And, we can built out static libs from the source code. However, we always get link error below when we want to have our shared lib with built static opencv libs.


ndk/sources/cxx-stl/stlport/stlport/stl/_alloc.h:343: error: undefined reference to 'std::bad_alloc::bad_alloc()' ndk/sources/cxx-stl/stlport/stlport/stl/_alloc.h:343: error: undefined reference to 'std::bad_alloc::bad_alloc()' ndk/sources/cxx-stl/stlport/stlport/stl/_alloc.h:343: error: undefined reference to 'std::bad_alloc::bad_alloc()' ndk/sources/cxx-stl/stlport/stlport/stl/_alloc.h:343: error: undefined reference to 'std::bad_alloc::bad_alloc()'


I show part of my Android.mk below. (PS: we don't use Application.mk due to we don't apply ndk-build directly)

---------- My own Android.mk LOCAL_CFLAGS := -O3 LOCAL_CPPFLAGS := -O3 -fexceptions -frtti

LOCAL_SRC_FILES:= \ libbokeh/inhousefft.cpp \ libbokeh/inhouse.cpp \

LOCAL_SHARED_LIBRARIES := \ libcutils \ libjpeg \ libgnustl_shared \ libstlport_shared \

LOCAL_LDFLAGS += -ldl

LOCAL_STATIC_LIBRARIES := \ libcxcore_i \ libcxcv_i \ libcxaux_i \ libcxhighui_i \ liblapack_i \


Please help me solve this problem.

Appreciations!!

Pico