Android and cross-compiling - android

I have a Linux library that needs to be compiled under Android. I understand that should be used to build this program: / home/user/android-ndk/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-gcc and then compile a ndk-build . I think right? Assembly via the utility should work correctly?

You need to install the Native Development Kit (NDK) and read through the documentation in the NDK about the build process. The NDK basic info is at http://developer.android.com/sdk/ndk/index.html, and you'll need to install an appropriate version of Cygwin (if you're using Windows).
It comes with a prebuilt compiler, so you shouldn't have to rebuild that.

Related

Building with Address Sanitizer on Android but with CMake

I am trying to build a .so for android and I want to build with address sanitizer but the only instructions I see are for Android NDK based Makefiles, but I am using the newer endorsed CMake setup. Just adding the flag -fsanitize=address wasn't enough as the clang runtime library was missing.
what is the correct thing to add in my CMakeLists for Android built libraries?
You also need to prepare your device as described in documentation. You have to run asan_device_setup script from NDK. It will put asan .so on the device.

build native code for android 64-bit arm architecture

We have a native .so file for 32-bit Android. We need to port it to 64-bit Android code (for Android L). We are not using NDK to build. We use make files and arm-linux-androideabi-g++ with command line options to build our source.
Can someone please let me know how to port our code to 64-bit Android platform?
You'll need to create a new standalone toolchain (same process you used to generate arm-linux-androideabi-g++) for arm64 (requires NDK r10).
http://www.kandroid.org/ndk/docs/STANDALONE-TOOLCHAIN.html

How to cross compile freetype library for android in Windows?

I'm trying to use freetype library in my native android application. But the only information about using this library with android ndk I found works only on *nix systems:
http://blog.beuc.net/posts/Cross-compile_FreeType_for_Android_ARM/
or
http://en.wikibooks.org/wiki/OpenGL_Programming/Installation/Android#FreeType
In other words, I can't perform cross-compiling procedure on windows system.
Is there any step-by-step reference about it or is it possible to download already cross-compiled version of freetype library?
Thank You!
When you are working with ndk under window systems you have to use cygwin for compilation, that is anyway *nix system.
You can do compilation using cygwin
Please refer this link
http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/
Have a look at this project which uses freetype, as I have managed to compile it succesfully using cygwin.

Cygwin for Android-NDK programming

I read about the requirements of NDK programming on Windows which said we require Cygwin.Read about Cygwin which said we require it coz it is a way to make Windows support some linux functionality.But my question is in which stage of programming(Where Exactly) Cygwin will be required and why? Addidtional info about this topic is most welcomed
Android NDK starting with revision 7 doesn't require Cygwin. See here: http://developer.android.com/sdk/ndk/index.html
You can now build your NDK source files on Windows without Cygwin by calling the ndk-build.cmd script from the command line from your project path. The script takes exactly the same arguments as the original ndk-build script. The Windows NDK package comes with its own prebuilt binaries for GNU Make, Awk and other tools required by the build. You should not need to install anything else to get a working build system.
It mentions you can not use ndk-gdb script without Cygwin. While that is true, you can actually use gdb executable directly without Cygwin, only then you'll need to set it up properly manually.
At least NDK-r8b, if you want to build your .so, you don't need Cygwin.
However, if you want to use ndk-gdb to debug your native code,you have to use Cygwin.
And, in my experiment, if you ndk-gdb your native under Cygwin to debug native code which is built from windows cmd, ndk-gdb seems cannot recognize the debug info. So, for debug purpose, I build native Cygwin.
Make command to execute Android.mk file.
Android.mk file consists of list of c/c++ files to be compiled and also the library name(.so).
(from NDK-r8e NDK-GDB document) At the moment 'ndk-gdb' requires a Unix shell to run. This means that Cygwin is required to run it on Windows. We hope to get rid of this limitation in a future NDK release.

Build Rsync for Android

I have downloaded rsync from http://rsync.samba.org/
anyone knows how to compile the source code to be deployed in an Android Device?
You can compile without the NDK assuming you statically link. This works for me on Ubuntu 13.04 Raring Ringtail.
Install the cross compiler:
sudo apt-get install gcc-arm-linux-gnueabi
Download rsync:
wget http://rsync.samba.org/ftp/rsync/rsync-3.0.9.tar.gz
tar -zxv -f rsync-3.0.9.tar.gz
cd rsync-3.0.9
Compile with the cross compiler, using static linking:
./configure --host=arm-linux-gnueabi CFLAGS="-static"
make
You'll get some warnings along the lines of Using X in statically linked applications requires at runtime the shared libraries from the glibc version used for linking. But so far, rsync has worked for me.
And finally, install to your phone (assumes you are using SSHDroid):
scp -P 2222 rsync root#$PHONE_IP:/data/data/berserker.android.apps.sshdroid/dropbear
You'll need the Android NDK found here
There are examples included on the web page and download of how to compile C code for Android.
From the NDK Website:
The NDK provides:
A set of tools and build files used to generate native code libraries
from C and C++ sources
A way to embed the corresponding native
libraries into an application package file (.apk) that can be deployed
on Android devices A set of native system headers and libraries that
will be supported in all future versions of the Android platform,
starting from Android 1.5. Applications that use native activities
must be run on Android 2.3 or later. Documentation, samples, and
tutorials
I did also find this if it's close to what you want to achieve.

Categories

Resources