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.
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.
Related
I'm experiencing an issue with Qt Creator in Windows:
I made an application that is using QtSerialPort and QtSerialBus libraries, I built and deployed it for windows and everything went well.
Now I'm trying to built it for Android but those libraries are not available as the official documentation states.
I downloaded the sources of QtSerialPort and QtSerialBus from Github and I'm now trying to build them by myself for Android.
AFAIK the issue I'm encountering is in the make install step, and this is the message I get:
08:05:28: Starting: "C:\Android\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" "INSTALL_ROOT=C:\Users\giovanni.lucenti\Downloads\qtserialport\android-build" install
cd src\ && ( if not exist Makefile C:\Qt\5.14.2\android\bin\qmake.exe -o Makefile C:\Users\giovanni.lucenti\Downloads\qtserialport-dev\src\src.pro -spec android-clang "CONFIG+=qtquickcompiler" "ANDROID_ABIS=armeabi-v7a" ) && C:/Android/ndk-bundle/prebuilt/windows-x86_64/bin/make -f Makefile install
make[1]: Entering directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src'
cd serialport\ && ( if not exist Makefile C:\Qt\5.14.2\android\bin\qmake.exe -o Makefile C:\Users\giovanni.lucenti\Downloads\qtserialport-dev\src\serialport\serialport.pro -spec android-clang "CONFIG+=qtquickcompiler" "ANDROID_ABIS=armeabi-v7a" ) && C:/Android/ndk-bundle/prebuilt/windows-x86_64/bin/make -f Makefile install
make[2]: Entering directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src/serialport'
La sintassi del nome del file, della directory o del volume non Š corretta.
make[2]: *** [Makefile:639: install_target] Error 1
make[2]: Leaving directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src/serialport'
make[1]: *** [Makefile:59: sub-serialport-install_subtargets] Error 2
make[1]: Leaving directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src'
make: *** [Makefile:61: sub-src-install_subtargets] Error 2
08:05:30: The process "C:\Android\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
Error while building/deploying project qtserialport (kit: Android for armeabi-v7a,arm64-v8a,x86,x86_64 (Clang Qt 5.14.2 for Android))
When executing step "Copy application data"
08:05:30: Elapsed time: 00:23.
I already tried to move the folder in a shorter path (C:\tmpbuild) but everything goes the same.
Am I missing something?
Where am I supposed to set the make install target path?
These are my Qt Creator build settings
You can't use QSerialPort on Android, as it is not suported there.
Google recently announced policy requiring support libraries be recompiled for 64bit support so I'm hoping someone else has also been down this road recently.
I'm trying to compile Speex 1.2 for Android 64bit ARM. I was able to build speex but speexdsp fails.
Here are the steps I took, followed by the failure:
Created a standalone toolchain:
~/android-ndk-r17/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=~/speex-toolchain --arch=arm64
Set my PATH to look first in the toolchain's bin directory
export PATH=~/speex-toolchain/bin:$PATH
Set the CC and RANLIB env vars (maybe not necessary?)
export CC=aarch64-linux-android-gcc
export RANLIB=aarch64-linux-android-ranlib
./configure --host=arm
make
Make fails with:
make all-recursive
make[1]: Entering directory `/Users/spartygw/Downloads/speexdsp-1.2rc3'
Making all in libspeexdsp
make[2]: Entering directory `/Users/spartygw/Downloads/speexdsp-1.2rc3/libspeexdsp'
CC preprocess.lo
CC jitter.lo
CC mdf.lo
CC fftwrap.lo
CC filterbank.lo
CC resample.lo
In file included from resample.c:104:0:
resample.c: In function 'resampler_basic_direct_single':
resample_neon.h:148:5: error: impossible constraint in 'asm'
asm volatile (" cmp %[len], #0\n"
^
make[2]: *** [resample.lo] Error 1
make[2]: Leaving directory `/Users/spartygw/Downloads/speexdsp-1.2rc3/libspeexdsp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/Users/spartygw/Downloads/speexdsp-1.2rc3'
make: *** [all] Error 2
Instead of steps 3 and 4, I would suggest just doing ./configure --host=aarch64-linux-android, which takes care of picking up the right tools, and which gets the target architecture right.
As for the main issue, the compilation error, the issue seems to be that speexdsp does support NEON (ARM's SIMD instruction set), but it detects it in configure in one way (by testing if #include <arm_neon.h> works and if NEON compiler intrinsics work, which work the same for both ARM and AArch64). Once it concluded that NEON is supported, it goes on to use it via inline assembly (which is different for ARM and AArch64).
So the conclusion is that speexdsp only supports NEON on ARM (32 bit), not on 64 bit, but speexdsp's configure script enables it incorrectly for AArch64 as well. Add --disable-neon to the configure call, and compilation should succeed.
I am trying to cross-compile GLibC 2.24 for ARM (Android) with the gcc-arm-linux-androideabi compiler. Here is the ./configure syntax I used:
../glibc-2.24/configure --prefix=/usr --host=arm-linux-androideabi --with-headers=/usr/include
However, when I run make, it fails with the following error:
In file included from
../sysdeps/arm/libc-tls.c:19:0:
../csu/libc-tls.c: In function '__libc_setup_tls':
../csu/libc-tls.c:191:1: error: '__ARM_NR_set_tls' undeclared (first use in this function)
../csu/libc-tls.c:191:1: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [/home/red/glibc-build/csu/libc-tls.o] Error 1
make[2]: Leaving directory `/home/red/glibc-2.24/csu'
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory `/home/red/glibc-2.24'
make: *** [all] Error 2
I browsed the web on why it happened, didn't find anything. What could be the cause of this error?
I am running Ubuntu 14.04.5 LTS 64-bit.
I am running Ubuntu 14.04.5 LTS 64-bit.
That is a meaningless statepement. 64-bit what? Is it sparc64, aarch64, x86_64, something else?
Most likely you are using x86_64. In that case, you are using configure all wrong. The --host=arm-linux-androideabi tells configure that you are building on an ARM linux machine, which couldn't be further from the truth.
What you likely mean is that you want to build for arm-linux-androideabi target, and in that case the correct configure command is something like:
configure --target=arm-linux-androideabi --prefix=/usr ...
Your --with-headers setting is also very likely to be incorrect: you almost certainly don't want to use /usr/include from x86_64 host to build for arm target.
I'm trying to compile GMP for android (arm) but I'm received a very strange error. First, I set up a few things as described another SO question here:
export NDKROOT=/prod/ndk
$NDKROOT/build/tools/make-standalone-toolchain.sh --platform=android-9 -- install-dir=$NDKROOT/android_armeabi
export CC="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-gcc --sysroot=$NDKROOT/android_armeabi/sysroot"
export CXX="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-g++ --sysroot=$NDKROOT/android_armeabi/sysroot"
export AR="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-ar"
export SYSROOT="$NDKROOT/android_armeabi/sysroot"
export PATH="$NDKROOT/android_armeabi/bin":$PATH
Then I simply run ./configure --enable-cxx --prefix=/local/to/where/i/want/to/install --host=arm-none-linux-gnueabi and configuration goes well, with the following being part of the output:
Version: GNU MP 5.1.1
Host type: arm-none-linux-gnueabi
ABI: standard
Install prefix: /location/to/where/i/want/to/install
Compiler: /prod/ndk/android_armeabi/bin/arm-linux-androideabi-gcc -- sysroot=/prod/ndk/android_armeabi/sysroot -std=gnu99
Static libraries: yes
Shared libraries: yes
Up to here it goes well, but when I run make, I receive the following error:
ismpf.cc: In function 'std::istream& operator>>(std::istream&, mpf_ptr)':
ismpf.cc:48:43: error: 'struct lconv' has no member named 'decimal_point'
make[2]: *** [ismpf.lo] Error 1
make[2]: Leaving directory `~/Downloads/gmp-5.1.1/cxx'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `~/Downloads/gmp-5.1.1'
make: *** [all] Error 2
So my first problem is there. Any ideas?
Just out of curiosity, I tried to rerun the same exact configure command as above but using sudo ahead of it. After a few seconds I receive the following:
configure: error: Oops, mp_limb_t is 64 bits, but the assembler code
in this configuration expects 32 bits.
There is the second (and really weird problem that arises).
Just out of curiosity again, I tried to reboot and clear all the variables we created, and simply run the command that the GMP manual recommends:
./configure --prefix=/location/ --enable-cxx --host=arm-linux-androideabi
The ./configure runs, the make goes well, but all 9/9 tests fail when I do make check. Can anybody point me in the right direction with these errors, or about how to try and correctly compile GMP for android? Any help is immensely appreciated.
Unsetting the CFLAGS env var solved the problem for me.
I'm attempting to build mono using the ndk standalone toolchain from the android ndk (version r8e), but I am unable to complete the build.
I setup my standalone environment like so:
export SYSROOT=/home/jeremybell/Desktop/android-ndk-r8e/platforms/android-14/arch-arm
/home/jeremybell/Desktop/android-ndk-r8e/build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir=./android-14-toolchain
Next, I configure mono. I'm using something similar to the example shown here:
http://permalink.gmane.org/gmane.comp.gnome.mono.patches/181374
Except for a few differences. First, I export each of the variables (AR, AS, CC, etc..) including SYSROOT (the configure script no longer takes a --sysroot=/path/to/sysroot option) prior to running configure. Second, I added --with-sgen=yes --disable-boehm
Here's my environment and my autogen.sh command:
export NDK=/home/jeremybell/Desktop/android-ndk-r8e
export SYSROOT=$NDK/platforms/android-14/arch-arm
export NDK_STANDALONE=/home/jeremybell/Desktop/monodevsrc/ndk_standalone
export PATH=$NDK_STANDALONE/bin:$PATH
export CC=arm-linux-androideabi-gcc
export CXX=arm-linux-androideabi-g++
export AR=arm-linux-androideabi-ar
export AS=arm-linux-androideabi-as
export CPP=arm-linux-androideabi-cpp
export LD=arm-linux-androideabi-ld
export RANLIB=arm-linux-androideabi-ranlib
export STRIP=arm-linux-androideabi-strip
./autogen.sh --build=`./config.guess` --host=armv5-linux-androideabi --target=armv5-linux-androideabi --enable-nls=no --with-mcs-docs=no --enable-mcs-build=no --with-glib=embedded --with-monodroid=yes CFLAGS="-DARM_FPU_NONE=1" CXXFLAGS="-DARM_FPU_NONE=1"
Configure appears to run fine, but make fails while building mono_sgen-main.o:
CC libmini_static_la-tramp-arm.lo
CC libmini_static_la-mini-posix.lo
CXXLD libmini-static.la
CC mono_sgen-main.o
main.c:7:22: fatal error: buildver.h: No such file or directory
compilation terminated.
make[4]: *** [mono_sgen-main.o] Error 1
make[4]: Leaving directory `/home/jeremybell/Desktop/monodevsrc/mono/mono/mini'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/jeremybell/Desktop/monodevsrc/mono/mono/mini'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/jeremybell/Desktop/monodevsrc/mono/mono'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/jeremybell/Desktop/monodevsrc/mono'
make: *** [all] Error 2
The offending line:
#include <config.h>
#include "mini.h"
#ifndef HOST_WIN32
#ifdef HAVE_SGEN_GC
#include "buildver-sgen.h"
#else
#include "buildver.h"
#endif
#endif
So, it looks like HAVE_SGEN_GC is not defined, but should be? Have I missed a step somewhere?
Thanks!
Update: This build issue appears to have cropped up between branch mono-2-10-8 and master. I'm able to build fine with the mono-2-10-8 branch. Hopefully that helps.