Android Native Camera: dlopen errors

asked 2014-08-29 00:10:12 -0500

bleater gravatar image

I'm using OpenCV 2.4.9's Android native camera library in a third-party project, and am hitting some inconsistent behaviour. On a Samsung Galaxy S2 running Android 2.3.3, the native libraries load fine and I get frames back from CameraActivity. However, on other devices, I don't even get past the dlopen.

The OpenCV libraries are statically linked, and the libnative_camera_r*.so files are correctly placed into the .apk, and correctly installed on the device (verified with adb shell ls).

Relevant logcat output from a failed launch on a Samsung Galaxy Tab 2.0 running Android 4.2.2 is below.

The dlopen failure is not failure to open the .so file, but rather to link the required symbol (demanged to android::Camera::setPreviewDisplay(android::sp<android::isurface> const&) )

Is there something obvious that I'm failing to link during my native build?

D/OpenCV::camera: Library name: libcameraNative.so
D/OpenCV::camera: Library base address: 0x592cf000
D/OpenCV::camera: Libraries folder found: /data/app-lib/com.mycompany.cameraNativeTest/
D/OpenCV::camera: CameraWrapperConnector::connectToLib: folderPath=/data/app-lib/com.mycompany.cameraNativeTest/
E/OpenCV::camera: ||libnative_camera_r2.3.3.so
E/OpenCV::camera: ||libnative_camera_r4.2.0.so
E/OpenCV::camera: ||libnative_camera_r4.3.0.so
E/OpenCV::camera: ||libnative_camera_r4.4.0.so
E/OpenCV::camera: ||libnative_camera_r4.1.1.so
E/OpenCV::camera: ||libnative_camera_r2.2.0.so
E/OpenCV::camera: ||libnative_camera_r3.0.1.so
E/OpenCV::camera: ||libnative_camera_r4.0.0.so
E/OpenCV::camera: ||libnative_camera_r4.0.3.so
D/OpenCV::camera: try to load library 'libnative_camera_r4.4.0.so'
D/OpenCV::camera: CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/app-lib/com.mycompany.cameraNativeTest/libnative_camera_r4.4.0.so, dlerror="Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "_ZN7android6Camera17setPreviewDisplayERKNS_2spINS_8ISurfaceEEE" referenced by "libnative_camera_r4.4.0.so"..."
D/OpenCV::camera: try to load library 'libnative_camera_r4.3.0.so'
D/OpenCV::camera: CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/app-lib/com.mycompany.cameraNativeTest/libnative_camera_r4.3.0.so, dlerror="Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "_ZN7android6Camera17setPreviewDisplayERKNS_2spINS_8ISurfaceEEE" referenced by "libnative_camera_r4.3.0.so"..."
D/OpenCV::camera: try to load library 'libnative_camera_r4.2.0.so'
D/OpenCV::camera: CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/app-lib/com.mycompany.cameraNativeTest/libnative_camera_r4.2.0.so, dlerror="Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "_ZN7android6Camera17setPreviewDisplayERKNS_2spINS_8ISurfaceEEE" referenced by "libnative_camera_r4.2.0.so"..."
D/OpenCV::camera: try to load library 'libnative_camera_r4.1.1.so'
D/OpenCV::camera: CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/app-lib/com.mycompany.cameraNativeTest/libnative_camera_r4.1.1.so, dlerror="Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "_ZN7android6Camera17setPreviewDisplayERKNS_2spINS_8ISurfaceEEE" referenced by "libnative_camera_r4.1.1.so"..."
D/OpenCV::camera: try to load library 'libnative_camera_r4.0.3.so'
D/OpenCV::camera: CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/app-lib/com.mycompany.cameraNativeTest/libnative_camera_r4.0.3.so, dlerror="Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "_ZN7android6Camera17setPreviewDisplayERKNS_2spINS_8ISurfaceEEE" referenced by "libnative_camera_r4.0.3.so"..."
D/OpenCV::camera: try to load library 'libnative_camera_r4.0 ...
(more)
edit retag flag offensive close merge delete

Comments

1

I'm having a similar issue with a 4.4.x device where deploying the apk with libnative_camera_r4.3.0.so and libnative_camera_r4.4.0.so causes a dlopen failed: cannot locate symbol "_ZN7android11BufferQueueC1EbRKNS_2spINS_19IGraphicBufferAllocEEE" error. Deploying with libnative_camera_r4.4.0.so only solves the problem. I'm guessing that when a libnative_camera_r*.so lib is loaded, it is not differentiated with respect to the current Android version, probably due to trusting OpenCV Manager keeping only the correct version around. I'm not going to use OpenCV manager anytime soon, so this is a bit tedious having to deploy multiple apks for multiple Android versions.

Ayberk Özgür gravatar imageAyberk Özgür ( 2014-10-09 03:36:49 -0500 )edit