Build Rsync for Android

僤鯓⒐⒋嵵緔 提交于 2020-01-07 08:19:07

问题


I have downloaded rsync from http://rsync.samba.org/ anyone knows how to compile the source code to be deployed in an Android Device?


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/42686747/how-does-an-android-app-install-a-required-unix-program-such-as-rsync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!