Search code examples
ffmpegcross-compilingautomake

Cross-compiling for ffmpeg : libvpx decoder version must be >=0.9.1


(Note: I know the title is almost identical to this question, but its solution is only applicable if I were building on my own system. I am building for an embedded ARM device.)

I am trying to build a cross-compile FFmpeg library to be targeted on an arm device, and the ./configure command tells me that libvpx is outdated.

My version of libvpx is as follows:

$ pkg-config --modversion vorbis 
1.3.2

When I run ./configure

$ ./configure --prefix=/home/test/Dev/build-arm/ffmpeg-armhf/ --enable-cross-compile --cross-prefix=${CCPREFIX} --arch=armhf --target-os=linux --pkg-config-flags="--libs vpx --static --cflags" --enable-shared --enable-libvpx 
ERROR: libvpx decoder version must be >=0.9.1

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.

My vpx.pc file is located in /usr/share/pkgconfig. Since it's for a different target (arm), Should I be putting this file somewhere else? :

# pkg-config file from libvpx v1.6.0-322-gc325fb7
prefix=/home/test/Dev/build-arm/libvpx
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: vpx
Description: WebM Project VPx codec implementation
Version: 1.6.0
Requires:
Conflicts:
Libs: -L${libdir} -lvpx -lm
Libs.private: -lm -lpthread
Cflags: -I${includedir}

In my config.log I see this:

(...lots of text...)
arm-openwrt-linux-gnueabi-gcc -Werror=missing-prototypes -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -march=armv7-a -std=c99 -fomit-frame-pointer -marm -fPIC -pthread -c -o /tmp/ffconf.cZcBLWc3.o /tmp/ffconf.sWjTIULb.m
arm-openwrt-linux-gnueabi-gcc: /tmp/ffconf.sWjTIULb.m: Objective-C compiler not installed on this system
check_pkg_config vpx >= 0.9.1 vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_vp8_dx
false --exists --print-errors vpx >= 0.9.1
check_lib2 vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_dec_init_ver -lvpx
check_func_headers vpx/vpx_decoder.h vpx/vp8dx.h vpx_codec_dec_init_ver -lvpx
check_ld cc -lvpx
check_cc
BEGIN /tmp/ffconf.gM9G9FSQ.c
    1   #include <vpx/vpx_decoder.h>
    2   #include <vpx/vp8dx.h>
    3   long check_vpx_codec_dec_init_ver(void) { return (long) vpx_codec_dec_init_ver; }
    4   int main(void) { return 0; }
END /tmp/ffconf.gM9G9FSQ.c
arm-openwrt-linux-gnueabi-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -march=armv7-a -std=c99 -fomit-frame-pointer -marm -fPIC -pthread -c -o /tmp/ffconf.cZcBLWc3.o /tmp/ffconf.gM9G9FSQ.c
/tmp/ffconf.gM9G9FSQ.c:1:29: fatal error: vpx/vpx_decoder.h: No such file or directory
compilation terminated.
ERROR: libvpx decoder version must be >=0.9.1

It looks like the include and library paths are not provided to the compiler, but I don't know how I should go around solving that. I would really appreciate it if you could offer some guidance.


Solution

  • Found it.

    My library is located at

    /home/test/Dev/build-arm/libvpx/lib
    

    But querying pkg-config gives

    $ arm-openwrt-linux-gnueabi-pkg-config --libs vpx
    -L/home/test/Dev/build-arm/home/test/Dev/build-arm/libvpx/lib -lvpx
    

    Turns out that my arm-openwrt-linux-gnueabi-pkg-config script was wrong.

    #!/bin/sh
    
    SYSROOT=/home/test/Dev/build-arm 
    export PKG_CONFIG_LIBDIR=${SYSROOT}/pkgconfig
    export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
    
    exec pkg-config "$@"
    

    This is the correct version, and it works now.

    #!/bin/sh
    
    SYSROOT=/home/test/Dev/build-arm 
    export PKG_CONFIG_LIBDIR=${SYSROOT}/pkgconfig
    export PKG_CONFIG_SYSROOT_DIR=
    
    exec pkg-config "$@"
    

    Thanks to the help from relaxed and furq (#ffmpeg irc.freenode.net)