aubio icon indicating copy to clipboard operation
aubio copied to clipboard

How do I build/compile Aubio for Android?

Open SamuelSaltzmann opened this issue 7 years ago • 10 comments

I had first created a stackoverflow question and then, as piem told me there, I opened it as an issue here:

Is there a step by step guide on how to build aubio for android - or at least a list of all the tools needed (waf, ndk, CMake, etc.) and how and when to use them? I have only developed apps for android in java before.

I just want to run a simple given example from the project.

I have already read the developer guides for android ndk and tried to figure out what to do with the waf files and the android example script. But i could not figure it out. (the ndk seems to use CMake, but i dont know how to use that correctly on my files and if it would work out - and if I would then still need waf). There is an example script in script/build_android but I was not able to make it work, yet. It seems really complicated and I have no clue where find helpful information.

The installing guide on the official website from aubio in the section for android is not very helpful and it feels outdated as the ndk seems to be integrated within the sdk since some time. (not helpful: https://aubio.org/manual/latest/installing.html#android)

Do you have any ideas where I could at least start to search for?

SamuelSaltzmann avatar Jul 03 '18 21:07 SamuelSaltzmann

I agree that the android documentation is minimum. I couldn't find pre-build libraries and there is no example or anything.

Some examples would be nice.

HBiSoft avatar Jul 25 '18 14:07 HBiSoft

I just found this:

https://github.com/adamski/aubio-android

HBiSoft avatar Jul 25 '18 14:07 HBiSoft

Yup but that has it last commit 3 years ago. Did that work out for you?

SamuelSaltzmann avatar Jul 25 '18 17:07 SamuelSaltzmann

@piem I tried building it running the build_android script, and realized I need to download NDK r12b, otherwise it wouldn't work. But I don't see these "contrib" folders anywhere. Here's the error:

+ NDK_PATH=/d/WinDir/Documents/aubio/scripts/../../android-ndk-r12b
+ WAFOPTS='--disable-avcodec --disable-samplerate --disable-jack --disable-sndfile'
+ '[' -z ']'
+ PLATFORM=android-19
+ '[' -z ']'
+ ARCH=arm
+ NDK_TOOLCHAINS=/d/WinDir/Documents/aubio/scripts/contrib
+ CURRENT_TOOLCHAIN=/d/WinDir/Documents/aubio/scripts/contrib/toolchain-android-19-arm
+ '[' -d /d/WinDir/Documents/aubio/scripts/contrib/toolchain-android-19-arm ']'
+ DESTDIR=/d/WinDir/Documents/aubio/scripts/dist-android-19-arm
+ '[' -d /d/WinDir/Documents/aubio/scripts/dist-android-19-arm ']'
++ ls '/d/WinDir/Documents/aubio/scripts/contrib/toolchain-android-19-arm/*-linux-android*/bin/gcc'
ls: cannot access '/d/WinDir/Documents/aubio/scripts/contrib/toolchain-android-19-arm/*-linux-android*/bin/gcc': No such file or directory
+ CC=

Really hope you can help!

ffpetrovic avatar Sep 08 '18 15:09 ffpetrovic

hi @SamuelSaltzmann, @HBiSoft, and @ffpetrovic

@SamuelSaltzmann there is not yet a full demo for aubio on android. We have juce_aubio in the pipelines, so there will soon be an easier way to prepare such a demo.

@ffpetrovic as you can see from the last line in the output of scripts/build_android, your NDK toolchain was not found.

You will need to specify where you have it installed by editing the variable NDK_PATH in scripts/build_android.

Sorry I forgot to reply to this question earlier.

Let us know how it goes, best, piem

piem avatar Sep 17 '18 18:09 piem

Hi, I get the same build issues with @ffpetrovic ; but when I changed the gcc path line, it worked fine;

#CC=`ls $CURRENT_TOOLCHAIN/*-linux-android*/bin/gcc`
CC=`ls $CURRENT_TOOLCHAIN/bin/arm-linux-androideabi-gcc-4.9` 

Nafeng avatar Apr 18 '19 02:04 Nafeng

i build successful use this.

#! /bin/bash

set -e
set -x

# location of android NDK
# NDK_PATH=$PWD/../contrib/android-ndk-r12
NDK_PATH=/home/heaven7/Android/Sdk/ndk-bundle
ARCH=arm64
TOOLCHAIN_PREFIX=aarch64
PLATFORM=android-28

WAFOPTS="--disable-avcodec --disable-samplerate --disable-jack --disable-sndfile"

# set these variables to change the default values
[ -z $PLATFORM ] && PLATFORM=$PLATFORM
[ -z $ARCH ] && ARCH=$ARCH

# location nof the standalone toolchains, created with
# $NDK_PATH/build/tools/make-standalone-toolchains.sh
NDK_TOOLCHAINS=$PWD/contrib

# location of the current toolchain
CURRENT_TOOLCHAIN=$NDK_TOOLCHAINS/toolchain-$PLATFORM-$ARCH

# if it does not exist, create the toolchain
[ -d $CURRENT_TOOLCHAIN ] || \
  $NDK_PATH/build/tools/make-standalone-toolchain.sh \
    --platform=$PLATFORM --arch=$ARCH \
    --install-dir=$CURRENT_TOOLCHAIN

# aubio install destination directory
DESTDIR=$PWD/dist-$PLATFORM-$ARCH

# wipe it out if it exists
[ -d $DESTDIR ] && rm -rf $DESTDIR

# get the link to gcc
#CC=`ls $CURRENT_TOOLCHAIN/*-linux-android*/bin/gcc`
CC=`ls $CURRENT_TOOLCHAIN/bin/$TOOLCHAIN_PREFIX-linux-android-gcc`

CFLAGS="-Os" \
  CC=$CC \
  ./waf distclean configure build install --destdir=$DESTDIR \
   --verbose \
   --with-target-platform=android $WAFOPTS

LightSun avatar Jun 14 '19 10:06 LightSun

Hi!

Getting an error: ./waf: No such file or directory

aksvox avatar Apr 28 '21 08:04 aksvox

@LightSun it seems like the new waf versions (2.0.23) no longer have --with-target-platform=android and other options. It would be great if you could help here, or specify the waf version used in the above script.

mannprerak2 avatar Jul 23 '23 05:07 mannprerak2

@aksvox I got the same error as I was running the android build script from the scripts directory. When I ran in the top aubio directory, the error no longer came.

jithesh82 avatar Aug 30 '23 20:08 jithesh82