build vp8 on android

旧街凉风 提交于 2019-12-30 01:35:28

问题


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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/7634392/build-vp8-on-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!