build vp8 on android
Asked Answered
W

2

6

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?

Witwatersrand answered 3/10, 2011 at 11:32 Comment(0)
C
9

From http://git.chromium.org/gitweb/?p=webm/bindings.git;a=blob_plain;f=JNI/README.Android with some adjustments for readability.

  1. Create {project}/jni folder.

  2. Get JNI bindings.

    git clone https://chromium.googlesource.com/webm/bindings

  3. Get libvpx.

    git clone https://chromium.googlesource.com/webm/libvpx

  4. Configure libvpx for Android

    ./libvpx/configure --target=armv7-android-gcc --disable-examples --sdk-path={path to NDK}

    --sdk-path MUST be absolute.

  5. Get libwebm.

    cd bindings/JNI

    git clone https://chromium.googlesource.com/webm/libwebm

  6. Get libogg.

    Download ogg code from http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz

    Extract to bindings/JNI.

  7. We need to run configure to generate config_types.h.

    cd libogg-1.3.0 && ./configure && cd ..

  8. Get libvorbis

    Download vorbis code from http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz

    Extract to bindings/JNI.

  9. Get libyuv

    svn checkout http://libyuv.googlecode.com/svn/trunk/ libyuv-read-only

  10. Create {project}/jni/Application.mk with the data below:

    APP_ABI := armeabi-v7a
    APP_OPTIM := release
    APP_STL := gnustl_static
    APP_CPPFLAGS := -frtti
    
  11. 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
    
  12. Build the JNI code.

    {path to NDK}/ndk-build

  13. Copy the java code.

    cp -R bindings/JNI/com/google ../src/com/

  14. 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);
    
  15. Run the app. You should see libwebm version output.

  16. Tweak as needed. VP8 wrappers are in the com.google.libvpx namespace.

Canarese answered 18/6, 2013 at 20:26 Comment(2)
fantastic answer! but - when I'm doing the following I'm always getting error during the configuration. It cannot instantiate the compiler. Here is the log: Unable to invoke compiler: /Users/yosef/Desktop/adt/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/Users/yosef/Desktop/adt/ndk/sources/android/libportable/arch-arm -I/Users/yosef/Desktop/adt/ndk/sources/android/cpufeatures -mtune=cortex-a8 -O3 -fPIC -W.. Do you know what might be the reason?Viaticum
the repos have been moved else where. Please update the repo links to get from the new root - chromium.googlesource.comThermal
C
0

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

Christopherchristopherso answered 24/1, 2012 at 20:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.