Has anybody out there successfully cross-compiled librtmp for the Android platform? I know that the rtmpdump android download has librtmp.so included, but I think I need librtmp.a also (I am trying to cross-compile ffmpeg with librtmp support).
Anybody had any luck with this? It's driving me bonkers....
Ta
Dan
have a look here http://stream-recorder.com/forum/rtmpdump-build-android-t13466.html
and I've put a howto on my github here https://github.com/S74ck3r/rtmpdump/blob/master/readme-howto-build.txt
hope that helps
Richard
I* just successfully built librtmp for Android using the Guardian Project's OpenSSL repo. I documented my steps here along with preserved build scripts.
In a nutshell, build OpenSSL per GuardianProject's directions, then run the following script in rtmpdump/librtmp:
#build_librtmp_for_android.sh
NDK=/path/to/android-ndk-r9c
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64
OPENSSL_DIR=/path/to/openssl-android/
# Note: Change the above variables for your system. Also ensure you've built openssl-android
function build_one
{
set -e
make clean
ln -s ${SYSROOT}usr/lib/crtbegin_so.o
ln -s ${SYSROOT}usr/lib/crtend_so.o
export XLDFLAGS="$ADDI_LDFLAGS -L${OPENSSL_DIR}libs/armeabi -L${SYSROOT}usr/lib "
export CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
export XCFLAGS="${ADDI_CFLAGS} -I${OPENSSL_DIR}include -isysroot ${SYSROOT}"
export INC="-I${SYSROOT}"
make prefix=\"${PREFIX}\" OPT= install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one
*with the incredible help of my pal Chris.
Related
I'm trying to compile PJSIP for Android. I follow official tutorial from this site: https://trac.pjsip.org/repos/wiki/Getting-Started/Android.
Unfortunately when I execute command "make dep" I get this error:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Samples.mak dependmake[2]: Nothing to be done for `depend'.
My steps:
- I cloned repo from svn. Also tried release package.
- I added config_site.h. Exactly the same as in tutorial.
- Android NDK export is defined in bash_profile.
- Execution of ./configure-android goes without any problems.
I'm using MacOS for building. I also tried on Ubuntu but I get the same error...
In MacOS I also have SWIG installed throught brew package manager.
Any ideas why I get this error?
Thanks in advance for any help.
Ok, I found out how to make it work. You have to modify Makefile in (project_root)/pjsip-apps/build and move line:
$(MAKE) -f Samples.mak $#
to saparate section without "depend":
clean realclean:
$(MAKE) -f Samples.mak $#
I want to install compile Boost 1.61 with clang 3.6 for android with the NDK 11 but this software : https://github.com/moritz-wundke/Boost-for-Android isn't updated and doesn't support this versions.
I want to know if anyone has managed to this !
Thank you !
Build boost_1_62_0 for Android-21 under Windows64.
Assuming NDK installed to C:\Programs\Android\sdk\ndk-bundle and boost in c:\boost_1_62_0.
Install mingw: using msys2-x86_64 from MSYS2
Install build tools from mingw prompt (something like this):
$ pacman -S gcc binutils
Create android.clang.jam file in C:\boost_1_62_0\ with such text content:
import os ;
local AndroidNDKRoot = C:/Programs/Android/sdk/ndk-bundle ;
using clang : android
:
C:/Programs/Android/toolchain21/bin/clang++
:
<compileflags>-fexceptions
<compileflags>-frtti
<compileflags>-fpic
<compileflags>-ffunction-sections
<compileflags>-funwind-tables
<compileflags>-Wno-psabi
<compileflags>-march=armv7-a
<compileflags>-mfloat-abi=softfp
<compileflags>-mfpu=vfpv3-d16
<compileflags>-fomit-frame-pointer
<compileflags>-fno-strict-aliasing
<compileflags>-finline-limit=64
<compileflags>-I$(AndroidNDKRoot)/platforms/android-21/arch-arm/usr/include
<compileflags>-Wa,--noexecstack
<compileflags>-DANDROID
<compileflags>-D__ANDROID__
<compileflags>-DNDEBUG
<compileflags>-O2
#<compileflags>-g
<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/include
<compileflags>-I$(AndroidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include
<architecture>arm
<compileflags>-fvisibility=hidden
<compileflags>-fvisibility-inlines-hidden
<compileflags>-fdata-sections
<cxxflags>-D__arm__
<cxxflags>-D_REENTRANT
<cxxflags>-D_GLIBCXX__PTHREADS
;
Setup boost from mingw prompt:
$ export NDK=/c/Programs/Android/sdk/ndk-bundle
$ echo ensure msi-installed Python is on path (not msys version):
$ export PATH=/c/Python27:$PATH
$ $NDK/build/tools/make_standalone_toolchain.py --arch arm --api 21 --install-dir /c/Programs/Android/toolchain21
$ ./bootstrap.sh --with-toolset=gcc
$ ./b2 --user-config=android.clang.jam threading=multi link=static \
runtime-link=static toolset=clang-android target-os=linux \
threadapi=pthread --stagedir=android --with-chrono \
--with-program_options --with-system --with-thread --with-random \
--with-regex
Yes, the repository you mentioned is apparently not maintained anymore. The author also seems not to answer any mails on the subject. If you look you'll see that each new boost version supported there required a lot of work (many special flags in the config files). That's presumably why he doesn't have time to maintain it any longer.
I also tried to update to 1.64 using a fork but gave up after countless error messages and instead used a different method based on a crystax script. Its simple and should work for pretty much any version. You can find the details and the script (simple and painless to execute) here: http://silverglint.com/boost-for-android/
Works with clang and gcc.
Also included is a sample app that shows you how to use the boost binaries thus built.
My final goal is to be able to profile native code (C++) in android environments using gperftools.
My environment/Tools:
ubuntu 14.04
crystax-ndk-10.2.1
gcc-4.8.4
gperftools-2.4
(1)
I followed through this to make a standalone toolchain for later use:
Cross compiling for arm using crystax NDK
command:
./build/tools/make-standalone-toolchain.sh --system=linux-x86_64 --toolchain=arm-linux-androideabi-4.8 --platform=android-8 --install-dir=$HOME/my-android-toolchain
(2)
Thankfully, I found a script that will simplify the ./configure work:
https://gist.github.com/nddrylliog/4688209
and just modified it a bit (put in gperftools-2.4 folder):
#!/bin/sh
export DEV_PREFIX=$HOME
export ANDROID_NDK=${DEV_PREFIX}/crystax-ndk-10.2.1/
export CROSS_COMPILE=arm-linux-androideabi
export ANDROID_PREFIX=$HOME/my-android-toolchain
export SYSROOT=${ANDROID_NDK}/platforms/android-8/arch-arm
export CROSS_PATH=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
export CPP=${CROSS_PATH}-cpp
export AR=${CROSS_PATH}-ar
export AS=${CROSS_PATH}-as
export NM=${CROSS_PATH}-nm
export CC=${CROSS_PATH}-gcc
export CXX=${CROSS_PATH}-g++
export LD=${CROSS_PATH}-ld
export RANLIB=${CROSS_PATH}-ranlib
# export PREFIX=${DEV_PREFIX}/android/prefix
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include -I${DEV_PREFIX}/android/bionic"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} "$#"
(3)
And then I actually do the ./configure and make install:
I put this script in gperftools-2.4 folder and run it:
cd gperftools-2.4
./android_configure.sh --enable-frame-pointers --prefix=$(pwd)
sudo make && make install
cd ..
Result:
The above gives me this error:
src/static_vars.cc: In function 'void tcmalloc::SetupAtForkLocksHandler()':
src/static_vars.cc:119:39: error: 'pthread_atfork' was not declared in this scope
CentralCacheUnlockAll); // child calls after fork
I would appreciate if anyone could leave me some advice on this.
Extra:
I know there is a android-ndk-profiler but since I use CMake for the cross-compilation and I'm not quite sure how to mess with the Android.mk so at the moment I will try to use gperftools which works fine in linux build.
This is because pthread_atfork appeared in Android libc (Bionic) only from Android 5.0. In CrystaX NDK, not all API are replaced by libcrystax, in particular, all pthread_xxx API reside in libc. So the only way as of now to do what you want is either use android-21 as minimal platform, or modify gperftools sources, avoiding usage of pthread_atfork.
BTW, we're working on moving all pthread_xxx API into libcrystax, so I expect all such API will be available soon even for earlier Android versions.
I am trying to import some third party module like pygoogle in my app when i run app in computer using kivy it works fine but when i make apk using buildozer it crashes every time then i find that i have to go in python-for-android and run this command to include module ./distribute.sh -m "pil ffmpeg kivy" but i still get error that
root#kali:~# cd ~/.buildozer/android/platform/python-for-android
root#kali:~/.buildozer/android/platform/python-for-android# ls
COPYING dist docs README.rst src
cythonizer.py distribute.sh LICENSE recipes tools
root#kali:~/.buildozer/android/platform/python-for-android# ./distribute.sh -m "pil ffmpeg kivy"
Check build dependencies for Kali
Avoid check build dependencies, unknow platform Kali
Check environment
No ANDROIDSDK environment set, abort
root#kali:~/.buildozer/android/platform/python-for-android#
I am using KAli Linux and please solve this someone ...it will be very helpfull to me
Try pasting the pygoogle folder in your app's directory, at the same level as main.py. Also, from the error, it looks like you need to set the ANDROIDSDK environment variable. See the docs.
I had a similar problem, and simply setting the ANDROIDSDK environment variable didn't sort it, but the following did.
Try the following and then run the ./distribute.sh -m "pil ffmpeg kivy" command from the same terminal(as the environment vars will only have been set for that terminal and any child processes), or alternatively, add these lines to your ~/.bashrc file for them to be permanent:
export ANDROIDSDK=/path/to/android-sdk
export ANDROIDNDK=/path/to/android-ndk
export ANDROIDNDKVER=rX
export ANDROIDAPI=X
# example
export ANDROIDSDK="/home/tito/code/android/android-sdk-linux_86"
export ANDROIDNDK="/home/tito/code/android/android-ndk-r7"
export ANDROIDNDKVER=r7
export ANDROIDAPI=14
Examples taken from here. I recommend having a look.
How can I build OpenSSL for Android ARM v7 (using Android NDK) on Win32?
Until the OpenSSL's wiki and setenv-android.sh are updated accordingly, I'll publish the recipe here. The required fixes to the process are:
Update setenv-android.sh to support Windows.
Update PATH to use Android NDK's (mingw) GNU make (rather than Cygwin's).
Invoke make with a Windows-style path to Cygwin's perl.
This recipe will be a strange hybrid of Cygwin and mingw (since Android NDK gcc toolchains for win32 are mingw). I'm assuming a Windows x86_64 build of the Android NDK unpacked into c:\android-ndk-r9d, and that you wish to use a gcc 4.8 toolchain.
Install Android NDK (duh!).
Install Cygwin -- make sure to include perl
Start Cygwin shell as an administrator to make sure native symlinks will work.
Within the console, run the following script to set the variables:
export \
CYGWIN=winsymlinks:native \
ANDROID_API=android-14 \
ANDROID_DEV=c:/android-ndk-r9d/platforms/android-14/arch-arm/usr \
PATH=/cygdrive/c/android-ndk-r9d/prebuilt/windows-x86_64/bin:/cygdrive/c/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin:$PATH \
MACHINE=armv7 \
SYSTEM=android \
ARCH=arm \
CROSS_COMPILE=arm-linux-androideabi-
Now, unpack openssl:
tar xzfv openssl-1.0.1i.tar.gz (or whatever your tarball is)
cd openssl-1.0.1i (or whatever your version is)
Make sure you have actual native Win32 (!) symlinks in include/openssl:
cmd /c "dir include\openssl"
You should see something like:
13-Aug-14 05:59 PM <SYMLINK> aes.h [..\..\crypto\aes\aes.h]
13-Aug-14 05:59 PM <SYMLINK> asn1.h [..\..\crypto\asn1\asn1.h]
(etc.)
Now it's time to configure:
./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/foo/bar
Ignore the failure to build (due to failure to find perl). We'll rectify this right away. Do this:
make PERL=$(cygpath -w $(which perl))
Now wait for a few minutes until it builds, and presto, you have your libcrypto.so etc.
Just a couple of comments on my experience with this:
Executing this statement:
PERL=$(cygpath -w $(which perl))
in the cygwin shell allows the shell to interpret the backslashes as escape characters and the build process chokes. To solve this I did the following:
$ echo $(cygpath -w $(which perl))
which produced the windows formatted path to the perl executable:
C:\cygwin64\bin\perl
Then I added this line to the export shown above:
PERL=c:/cygwin64/bin/perl \
There are other ways of doing this, but it worked and headed off the problem with the ./config statement documented above (not finding perl).
Second issue was the -no- statements. After running the configure, the script reports that you'll have to run make depend. I wanted to exclude MD5 (i.e. -no-md5) and when I did the make depend, it errored out with a report that MD5 was disabled. Uhhh, yes, that was kind of the idea, but I just won't use MD5 hashes. I did use the -no-ssl2 and didn't get any complaints after the make depend.
Third issue and this is a mystery. The build broke on compiling crypto because it could not find a symbol that is supposed to be defined in /crypto/objects/obj_xref.h. When I looked at the file, it was empty. Something in the perl script I suppose, but no time to debug right now, since I'm at proof of concept phase. I placed a copy from a patch that I picked up at https://github.com/devpack/openssl-android
After that, my build ran to completion. I've done no testing with this and it is not a trustworthy solution, but it did compile and produce the static libraries that I need for proof of concept for my client.
Just as an update, my shared library built with these libraries loaded fine on my target.