Search code examples
androidvlclibvlc

Building LibVLC for x86


I've been trying to use LibVLC for Android and I followed the instructions at https://wiki.videolan.org/AndroidCompile and got it to work perfectly for ARM. However, when trying to compile it to x86, I set:

export ANDROID_ABI=x86

and then compiled in the same way, but now I have a problem as it fails to compile. Here's a truncated build log:

~/vlc-android$ sh compile.sh
VLC source found
Building tools
You are ready to build VLC and its contribs
Building the contribs
Generating EGL pkg-config file
Generating GLESv2 pkg-config file
Guessing build system... x86_64-linux-gnu
Creating configuration file... config.mak
Bootstrap completed.

...

config.status: executing libtool commands
Type "make; make install" to compile and install Speex
cd speexdsp && make install
make[1]: Entering directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp'
Making install in libspeexdsp
make[2]: Entering directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp/libspeexdsp'
  CC       resample.lo
In file included from resample.c:104:0:
resample_neon.h:142:21: error: redefinition of 'inner_product_single'
 static inline float inner_product_single(const float *a, const float *b, unsigned int len)
                     ^
In file included from resample.c:100:0:
resample_sse.h:40:21: note: previous definition of 'inner_product_single' was here
 static inline float inner_product_single(const float *a, const float *b, unsigned int len)
                     ^
make[2]: *** [resample.lo] Error 1
make[2]: Leaving directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp/libspeexdsp'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/user/vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp'
make: *** [.speexdsp] Error 2

As far as I can tell, in that project for some reason both the ARM headers and the SSE headers are being included, causing a redefinition error. However, I don't know why or what to try to fix it. Any suggestions would be much appreciated.


Solution

  • Autoconf doesn't look quite right, x86 build has nothing to do with NEON instruction set hence should not include resample_neon.h. I haven't found the root cause yet but for a quick solution, open resample.c under ../vlc-android/vlc/contrib/contrib-android-i686-linux-android/speexdsp/libspeexdsp and delete the following lines:

    ...
    #ifdef _USE_NEON
    #include "resample_neon.h"
    #endif
    ...
    

    then rerun the compile.sh, you should get a working apk for your x86 emulator/device.