calling ndk-build for echoPrint android sample - android

I'm getting this error after calling the ndk-build command in the cmd.
I followed the steps in this link http://masl.cis.gvsu.edu/2012/01/25/android-echoprint/
make.exe: *** No rule to make target `/codegen/src/Codegen.cpp', needed by `obj/
local/armeabi/objs/echoprint-jni//codegen/src/Codegen.o'. Stop.
Can any one help me with this issue?

I don't know which platform the blog author used, and which version of NDK this was. But if you simply remove the heading "/" from the lines in Android.mk file, it should simply compile for you:
LOCAL_SRC_FILES :=AndroidCodegen.cpp \
codegen/src/Codegen.cpp \
codegen/src/Whitening.cpp \
codegen/src/SubbandAnalysis.cpp \
codegen/src/MatrixUtility.cpp \
codegen/src/Fingerprint.cpp \
codegen/src/Base64.cpp \
codegen/src/AudioStreamInput.cpp \
codegen/src/AudioBufferInput.cpp

Related

Android NDK Build FFMPEG in 2021

I'm working on an android app, and I have to convert webm files to mp3.
I really want to make a custom ffmpeg build, because it reduces the ffmpeg executable size to only 2MB.
My library works absolutely fine when running on my PC, but i'm struggling to build it for android... It seems like NDK architecture has changed and tutorials are outdated, and I can't find a proper and recent guide for android compiling...
I also would like to target all architectures (aarch64, armv7, i686, and x86_64)...
I've been on this for hours, fixed many errors, but still nothing has worked ><.
Please help me ! :\
PS. I'm compiling on Linux, here is my configuration script:
#!/bin/bash
API=31 # target android api
OUTPUT=/home/romain/dev/android/ffmpeg_build
NDK=/home/romain/android-sdk/ndk/23.0.7599858
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
SYSROOT=$TOOLCHAIN/sysroot
TOOL_PREFIX="$TOOLCHAIN/bin/aarch64-linux-android"
CC="$TOOL_PREFIX$API-clang"
CXX="$TOOL_PREFIX$API-clang++"
./configure \
--prefix=$OUTPUT \
--target-os=android \
--arch=$ARCH \
--cpu=$CPU \
--disable-everything \
--disable-everything \
--disable-network \
--disable-autodetect \
--enable-small \
--enable-decoder=opus,vorbis \
--enable-demuxer=matroska \
--enable-muxer=mp3 \
--enable-protocol=file \
--enable-filter=aresample \
--enable-libshine \
--enable-encoder=libshine \
--cc=$CC \
--cxx=$CXX \
--sysroot=$SYSROOT \
--extra-cflags="-0s -fpic"
make
make install
The prefix should point to $SYSROOT/usr/ and you misunderstood what --prefix mean. Its not output directory. Other than that i think nothing problematic than that (if it still happen please provide ffbuild/config.log)
The repository pointed to by the previous answer is no longer being maintained.
Here is an updated one.
This is the android branch: https://github.com/arthenica/ffmpeg-kit/tree/main/android

android nkd no include path in which to search for limits.h #include_next <limits.h>

When i build the x264 ndk library , i face a problem .
I've compiled both in window and liunx environment.i got the same mistakes...
like this:
In file included
from c:\users\xxx\appdata\local\android\sdk\ndk-bundle\toolchains\
aarch64-linux-android-4.9\prebuilt\windows-x86_64\lib\gcc\aarch64-linux-android\4.9.x\include-fixed\syslimits.h:7:0,
from c:\users\xxx\appdata\local\android\sdk\ndk-bundle\toolchains\
aarch64-linux-android-4.9\prebuilt\windows-x86_64\lib\gcc\aarch64-linux-android\4.9.x\include-fixed\limits.h:34,
from ./common/common.h:123,
from ./x264cli.h:30,
from ./input/input.h:31,
from ./filters/video/video.h:29,
from ./filters/video/depth.c:26:
c:\users\xxx\appdata\local\android\sdk\ndk-bundle\toolchains\aarch64-linux-android-4.9\
prebuilt\windows-x86_64\lib\gcc\aarch64-linux-android\4.9.x\include-fixed\limits.h:168:61:
error: no include path in which to search for limits.h
#include_next <limits.h> /* recurse down to the real one */
make: *** [.depend] Error 1
Here is my script:
SYSROOT=$NDK/platforms/android-21/arch-arm64
TOOLCHAIN=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64
CC=$TOOLCHAIN/bin/aarch64-linux-android-gcc-4.9.x
#CXX=$TOOLCHAIN/bin/aarch64-linux-android-g++
CROSS_PREFIX=$TOOLCHAIN/bin/aarch64-linux-android-
EXTRA_CFLAGS="-march=armv8-a -D__ANDROID__"
EXTRA_LDFLAGS="-nostdlib"
./configure --prefix=$PREFIX \
--host=arm-linux \
--sysroot=$SYSROOT \
--cross-prefix=$CROSS_PREFIX \
--extra-cflags="$EXTRA_CFLAGS" \
--extra-ldflags="$EXTRA_LDFLAGS" \
--enable-pic \
--enable-static \
--enable-strip \
--disable-cli \
--disable-win32thread \
--disable-avs \
--disable-swscale \
--disable-lavf \
--disable-ffms \
--disable-gpac \
--disable-lsmash \
--disable-asm \
--disable-opencl
does anyone know how to solve it? thanks every much.
To build with latest NDK You need to use --deprecated-headers while creating standalone toolchain.
Some additional info: NDK unified headers
This problem occurs when you use recent versions of android ndk. Please, use older versions like android ndk r13b. I have successfully built on my mac machine using android ndk r13b.
Link given below:
https://dl.google.com/android/repository/android-ndk-r13b-darwin-x86_64.zip
Please, use one specific to your platform.
You can also follow this link https://osburneblog.wordpress.com/2017/06/01/cross-compiling-ffmpeg-and-libx264-for-android/ know more about build process.

Errors in building ffmpeg for android

I have followed lots of tutorials for buildinf ffmpeg.so file like
http://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/
http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
and many more tutorials but at last i have stuck to this error every time i dont know how to resolve it please any one knows how to solve it then help me
my build.sh file look like this
NDK=C:/Users/Benzatine/Downloads/android-ndk-r10e
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains//arm-linux-androideabi-4.8/prebuilt/windows-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
But when it executes make command it gives following error
LD libswscale/libswscale-3.so
c:/users/benzatine/downloads/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: libavutil/libavutil.so:1:1: syntax error, unexpected '!', expecting $end
c:/users/benzatine/downloads/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: libavutil/libavutil.so: not an object or archive
collect2.exe: error: ld returned 1 exit status
library.mak:111: recipe for target 'libswscale/libswscale-3.so' failed
make: *** [libswscale/libswscale-3.so] Error 1
every time i try to build ffmpeg this error occure how to resolve it please someone help me
I am going to assume that you are building it on Windows system based on the error message.
I just found this post on Facebook group so I am not going to take any credit for it.Bascially he just use other project and tweak it to make it work forcefully.It use Android 'Love' version and compile it in Windows system.
FFMpeg (https://www.ffmpeg.org), one of the most used libary written in C programming language for multimedia related task.
It has a lot of feature to add multimedia support for your application but the trouble being a 'C' library we have
port it into other language if you don't want to create your application in C/C++. Trust me porting it into
different language is a lot of work which are filled with error. Luckily you can find tutorial and easy build
script in the internet but unfountenly , they are only written by assumption that you are porting it
into nix based OS and the few tutorial on porting it on Windows OS does not work (atleast for me. :) )
But the main reason I am using ffmpeg is to add a multimedia feature to the android which are not
provided by standard Android API. I found some pre-made android project on an internet
which use FFMpeg 'Love' version. Here is the project.
In case you are wondering how to use it in your Android project , here are the step
1) Add a native support to the Android Project by right-clicking the Android Tools>Add Native Support...
2) Copy 'armeabi' folder to 'libs' folder of your project
3) Replace 'obj' folder with the 'obj' of ffmpeg project in the attached file
4) Add 'ffmpeg' folder to the 'jni' folder
5) Replace 'Androd.mk' folder with the 'Android.mk' of the ffmpeg project in the attached file
6) Write your code in C/C++ and enjoy
As always if you have any trouble or question you can comment them and I will answer them as soon as possible
Attached file:http://robot-mitya.googlecode.com/files/MyFfmpegTest.zip
Source:http://dmitrydzz-hobby.blogspot.com/2012/04/how-to-build-ffmpeg-and-use-it-in.html

Why libclcore in directory "host" in android 4.4 source code not update like target?

Now I want to add a function into RenderScript to support a new interface by myself.
I wrote the code and add myFunc.c file into "android-4.4-src/frameworks/rs/driver/runtime/", and modify Android.mk(append myFunc.c to clcore_base_files at line 20):
clcore_base_files := \
rs_allocation.c \
rs_cl.c \
rs_core.c \
rs_element.c \
rs_mesh.c \
rs_matrix.c \
rs_program.c \
rs_sample.c \
rs_sampler.c \
convert.ll \
allocation.ll \
rsClamp.ll \
myFunc.c
Then add myFunc.rsh into "android-4.4-src/frameworks/rs/scriptc/", and include myFunc.rsh in rs_core.rsh which in the same directory:
#include "myFunc.rsh"
And then I rebuild:
$ source build/envsetup.sh
$ lunch sdk-eng
$ make sdk
The weird thing is: libclcore.bc in "out/target/product/generic/system/lib/" is the new version which contains the function I wrote, but the libclcore.bc in "out/host.linux-x86/sdk/androidXXX/build-tools/android-4.4.3.2xxx/renderscript/lib" is the old version.
I want to update the old version in "host" like the one in "target" when rebuild.
Is there some configurations I forgot?
Any suggestions would be appreciated!

Building FFMPEG with librtmp for android

I'm trying to build all-in-one static binary of FFMPEG with NDK r7b and everything works fine untill i try to build it with RTMP support.
I'm usind sources from https://github.com/guardianproject/android-ffmpeg with librtmp2.4 and custom config like this
.configure \
--target-os=linux \
--cross-prefix=arm-linux-androideabi- \
--arch=arm \
--sysroot=/home/andrey/android-ndk-r7b/platforms/android-3/arch-arm \
--enable-static \
--disable-shared \
--disable-symver \
--enable-small \
--disable-devices \
--disable-avdevice \
--enable-gpl \
--enable-librtmp \
--prefix=../build/ffmpeg/armeabi \
--extra-cflags=-I../rtmpdump/librtmp \
--extra-ldflags=-L../rtmpdump/librtmp \
and rtmpdump directory lays on the same level as ffmpeg.
As i understand last two strings in my config says where compiler may find sources of librtmp.
But all i get is ERROR: librtmp not found
I'm not expereienced with NDK and obviosly i missing some important part but i can't find it by myself.
This is challenging, but I think I have a solution. The problem at configure-time is that FFmpeg wants to detect a proper librtmp installation via the pkg-config management system.
I'm assuming your have successfully cross-compiled librtmp in the directory referenced by ../rtmpdump. Edit the FFmpeg configure script and search for the line:
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
Comment that out (put a '#' at the front of the line). Now, re-run configure, only with these modifications:
--extra-cflags="-I/full/path/to/rtmpdump"
It may help to have an absolute path here. Also, omit /librtmp/ at the end since the #include directives already prefix the header files with librtmp/. Next:
--extra-ldflags="-L/full/path/to/rtmpdump -lrtmp"
Again, absolute path, and specify the library to link against since we commented out that logic via configure.
Now, configure should succeed and the cross-compilation should also be happy. The final ffmpeg binary should report the family of RTMP modules under protocols:
ffmpeg -protocols
[...]
rtmp
rtmpe
rtmps
rtmpt
rtmpte
Note that I don't have an NDK dev environment to test this on. But I tested on my desktop Ubuntu system by compiling librtmp (without the package being installed via pkg-config) and then performing the above steps.

Categories

Resources