I'm trying to build the vp8 codec for Android. I ran the configure.sh script and the makefile for armv6 with sourcery g++ which succesfully produced libvpx.so. After that I wrote a JNI wrapper and compiled it with ndk-build succesfully. When I run this on a Gingerbread smartphone I got a UnsatisfiedLinkError "libpthread.so.0 not found". How can I get rid of this error?
From http://git.chromium.org/gitweb/?p=webm/bindings.git;a=blob_plain;f=JNI/README.Android with some adjustments for readability.
Create {project}/jni folder.
Get JNI bindings.
Get libvpx.
Configure libvpx for Android
./libvpx/configure --target=armv7-android-gcc --disable-examples --sdk-path={path to NDK}
--sdk-path
MUST be absolute.Get libwebm.
cd bindings/JNI
Get libogg.
Download ogg code from http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
Extract to bindings/JNI.
We need to run configure to generate config_types.h.
cd libogg-1.3.0 && ./configure && cd ..
Get libvorbis
Download vorbis code from http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
Extract to bindings/JNI.
Get libyuv
svn checkout http://libyuv.googlecode.com/svn/trunk/ libyuv-read-only
Create {project}/jni/Application.mk with the data below:
APP_ABI := armeabi-v7a APP_OPTIM := release APP_STL := gnustl_static APP_CPPFLAGS := -frtti
Create {project}/jni/Android.mk with the data below:
WORKING_DIR := $(call my-dir) BINDINGS_DIR := $(WORKING_DIR)/bindings/JNI include $(BINDINGS_DIR)/Android.mk
Build the JNI code.
{path to NDK}/ndk-build
Copy the java code.
cp -R bindings/JNI/com/google ../src/com/
Add code to test the bindings.
int[] major = new int[2]; int[] minor = new int[2]; int[] build = new int[2]; int[] revision = new int[2]; MkvMuxer.getVersion(major, minor, build, revision); String outStr = "libwebm:" + Integer.toString(major[0]) + "." + Integer.toString(minor[0]) + "." + Integer.toString(build[0]) + "." + Integer.toString(revision[0]); System.out.println(outStr);
Run the app. You should see libwebm version output.
Tweak as needed. VP8 wrappers are in the com.google.libvpx namespace.
This can sometimes be a problem with the SONAME in a shared library, have a look at this article.
http://groups.google.com/group/android-ndk/browse_thread/thread/fd484da512650359
You could disable pthreads if you don't really need them.
Iv'e had problems with .so files in the past and have avoided all of these problems by using .a static libraries instead of .so shared libraries
© 2022 - 2024 — McMap. All rights reserved.