Building mono with android ndk standalone toolchain (android ndk r8e) - android

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.

Related

Issue building Qt libraries in Qt Creator (Windows)

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.

How to compile and execute MPICH2 for Android

For cross compiling MPICH2 for Android.
I found the reference here
http://hex.ro/wp/projects/personal-cloud-computing/compiling-mpich2-for-android-and-running-on-two-phones/
and here
www.scientificbulletin.upb.ro/rev_docs_arhiva/fullffc_583765.
I did following
BuildRoot
Used Build Root (buildroot-2016.02) for cross compiling ARM toolchain
Target options :
Target Architecture as ARM little endian
Target binary format as ELF
Selected Toolchain as Buildroot toolchain (Internal)
Kernel headers as 3.12.x
C library as uClibc
After this make command was run.
MPICH2
mpich-3.2.tar.gz was extracted and following commands were executed
1. $ export PATH=/home/mpiuser/CrossBuild/buildroot-2016.02/output/host/usr/bin:$PATH
2. $ sudo ./configure --prefix=/home/mpiuser/CrossBuild/arm-mpich-install --disable-fortran CC=/home/mpiuser/CrossBuild/buildroot-2016.02/output/host/usr/bin/arm-linux-gcc --host=arm-linux
After this make was run for mpich-3.2, and during compilation following error was thrown :
GEN lib/libmpi.la
CXX src/binding/cxx/initcxx.lo
CXXLD lib/libmpicxx.la
lib/.libs/libmpi.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libmpicxx.la] Error 1
make[2]: Leaving directory `/home/mpiuser/CrossBuild/mpich-3.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/mpiuser/CrossBuild/mpich-3.2'
make: *** [all] Error 2
Request to please help. Thanks

Building android kernel from source gives me error! (Lenovo TAB 2 A8-50F)

I've successfully flashed a wrong boot.img onto my tablet, and i cannot turn it on now. (yeah, i've got a bootloop)
I've already downloaded the SP flash tool and the original source code but somehow i cannot compile the kernel from it...i guess, something is missing.
Here is what i did so far:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
cd android
tar xvf lenovo_tab_2_a8-50_osc_201505.tar.gz
export ARCH=arm64
export CROSS_COMPILE=~/aarch64-linux-android-4.9/bin/aarch64-linux-android-
make lcsh8735_6tb_a8_l_defconfig
make -j2
And I've got this output:
drivers/misc/mediatek/gpio/mt6735/mt_gpio_debug.c:21:23: fatal error: gpio_init.h: No such file or directory
#include <gpio_init.h>
^
compilation terminated.
make[5]: *** [drivers/misc/mediatek/gpio/mt6735/mt_gpio_debug.o] Error 1
make[4]: *** [drivers/misc/mediatek/gpio/mt6735] Error 2
make[3]: *** [drivers/misc/mediatek/gpio] Error 2
make[2]: *** [drivers/misc/mediatek] Error 2
make[1]: *** [drivers/misc] Error 2
make: *** [drivers] Error 2
make: Leaving directory `/home/hunwalk/android/Lenovo_A8/alps/kernel-3.10'
hunwalk#hunwalk-K73SV:~/android/Lenovo_A8/alps/kernel-3.10$
Could somebody help me?
Error
fatal error: linux/netfilter/xt_mark.h: No such file or directory
normally arises when you build kernel on shared folders or other filesystem which doesn't support links.
Build kernel on local Linux filesystem (ext4, xfs, etc.).
Edit the mt_gpio_debug.c file and replace this line #include <gpio_init.h> with ' #include "gpio_init.h" '
It's seems like a typo in most mt6735/mt6753 kernel source codes.
Source: Github

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.
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.

Configuration error of the GMP library for the android platform

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.

Categories

Resources