mirror of
https://github.com/CoderSherlock/CoderSherlock.github.io.git
synced 2026-06-13 08:08:10 -07:00
Waste_Whole_Afternoon_on_Blog
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Cross Compile on Mil años de solitario</title>
|
||||
<link>https://CoderSherlock.github.io/categories/cross-compile/</link>
|
||||
<description>Recent content in Cross Compile on Mil años de solitario</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>en-us</language>
|
||||
<copyright>Copyright (c) 2016 - 2016, Pengzhan Hao; all rights reserved.</copyright>
|
||||
<lastBuildDate>Mon, 15 Aug 2016 15:44:05 -0400</lastBuildDate>
|
||||
<atom:link href="https://CoderSherlock.github.io/categories/cross-compile/index.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
<item>
|
||||
<title>Cross Compile RSync ARM</title>
|
||||
<link>https://codersherlock.github.io/post/Cross-Compile-RSync-ARM/</link>
|
||||
<pubDate>Mon, 15 Aug 2016 15:44:05 -0400</pubDate>
|
||||
|
||||
<guid>https://codersherlock.github.io/post/Cross-Compile-RSync-ARM/</guid>
|
||||
<description>
|
||||
|
||||
<p>As always, feel free to ask. // Sherlock</p>
|
||||
|
||||
<h1 id="motivation">Motivation</h1>
|
||||
|
||||
<p>I got some issues about compile seafile to android, so instead of doing so, I start to figure out some other synchronize workflow. <a href="https://rsync.samba.org/">Rsync</a> is one of the most mature synchronization solution. So I made the decision on planting rsync to android.</p>
|
||||
|
||||
<h1 id="pre-work">Pre-work</h1>
|
||||
|
||||
<p>Rsync is a sync program with delta sync feature and based on SSH connection. So all we need to do is SSH support and cross compile tool-chain. Similar to what I mentioned in <a href="https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/">previews blog</a>, Android NDK and environment export need to be done before compilation.
|
||||
To enable normally use of compiled program, we need to make android support SSH. My solution is just install <a href="https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&amp;hl=en">SSHDroid</a> from Google Play Store.</p>
|
||||
|
||||
<h1 id="cross-compile-rsync">Cross-Compile Rsync</h1>
|
||||
|
||||
<p>Running following script to build rsync. It will generate a executable file named rsync in the root directory.</p>
|
||||
|
||||
<pre><code>$ ./configure --build=${BUILD_SYS} --host=${TOOLCHAIN}
|
||||
$ make
|
||||
</code></pre>
|
||||
|
||||
<h1 id="push-rsync-to-android">Push RSync to Android.</h1>
|
||||
|
||||
<p>After installing SSHDroid, we can now push our arm-version-rsync to target machine.</p>
|
||||
|
||||
<pre><code>$ adb push rsync /data/local/tmp
|
||||
$ adb shell
|
||||
|
||||
$ cd /data/data/berserker.android.apps.sshdroid/dropbear
|
||||
$ mv ../../../local/tmp/rsync .
|
||||
</code></pre>
|
||||
|
||||
<h1 id="run-rsync-with-argument">Run Rsync with argument</h1>
|
||||
|
||||
<p>Now we can easily use rsync in android shell. Similar to what we use on PC.</p>
|
||||
|
||||
<pre><code>$ ./rsync -e &quot;./ssh&quot; {target-data} {target-location}:{target-directory}
|
||||
</code></pre>
|
||||
|
||||
<h1 id="references">References</h1>
|
||||
|
||||
<p><a href="http://stackoverflow.com/questions/8130889/build-rsync-for-android">Build Rsync for Android</a></p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Cross Compile Seafile to ARM</title>
|
||||
<link>https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/</link>
|
||||
<pubDate>Sat, 30 Jul 2016 14:02:34 -0400</pubDate>
|
||||
|
||||
<guid>https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/</guid>
|
||||
<description>
|
||||
|
||||
<h1 id="motivation">Motivation</h1>
|
||||
|
||||
<p>This project is working for delta sync from mobile to server. Currently, there&rsquo;s no mobile program/solution has supporting to delta sync(Include Dropbox/ Goggle Drive). But the truth is that almost every pc version sync program can work as delta sync properly or not. So in this article, I&rsquo;ll provide a workbench for cross compilation and evaluation. And finally come up with a reason of how to port better incremental synchronize solution on mobile platform.</p>
|
||||
|
||||
<h1 id="pre-work">Pre-work</h1>
|
||||
|
||||
<p>Basically, I used the native android compilation tool-chains, <a href="https://developer.android.com/ndk/downloads/index.html">Android NDK</a>, as working tools. Due to my working situation, I use a <a href="https://shield.nvidia.com/tablet/k1">Nvidia Shield Tablet</a> as target device. As <em>Zengwen</em> said in his <a href="http://zwyuan.github.io/2016/07/17/cross-compile-glib-for-android/">blog</a>, newest updated NDK might has some issue which can influence compilation progress. So you can find <a href="http://stackoverflow.com/questions/6849981/where-do-i-find-old-versions-of-android-ndk">other version</a> of NDK once you have some problems. Based on what <em>Zengwen&rsquo;s</em> blog mentioned, we can write following useful system environment and export in terminal.</p>
|
||||
|
||||
<h2 id="prerequisites">Prerequisites</h2>
|
||||
|
||||
<pre><code>$ sudo apt-get install build-essential
|
||||
$ sudo apt-get install pkg-config automake autoconf libtool
|
||||
</code></pre>
|
||||
|
||||
<h2 id="link-with-standalone-tool-chains">Link with standalone tool-chains</h2>
|
||||
|
||||
<p>In order to build standalone tool-chains, we need first to export following system environment. After doing that, we can use following command to build a standalone tool-chains from downloaded NDK.</p>
|
||||
|
||||
<pre><code>$ ${NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=arm-linux-androideabi-4.9 \
|
||||
--stl=gnustl \
|
||||
--arch=arm \
|
||||
--ndk-dir=/home/moslab/Android/android-ndk-r12b \
|
||||
--package-dir=/home/moslab/Android \
|
||||
--install-dir=/home/moslab/Android/android-ndk-toolchain \
|
||||
--platform=android-22
|
||||
</code></pre>
|
||||
|
||||
<h2 id="original-system-environment-configuration">Original System Environment Configuration</h2>
|
||||
|
||||
<p>[TODO]-&gt; I will fix this part later.</p>
|
||||
|
||||
<pre><code># Android NDK sources and standalone toolchain is put here
|
||||
export DEV=~/Android/
|
||||
|
||||
# All the built binaries, libs and their header will be installed here
|
||||
export PREFIX=/opt/android
|
||||
|
||||
# Don't mix up .pc files from your host and build target
|
||||
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
|
||||
|
||||
# GCC for Android version to use
|
||||
# 4.9 is the only available version since NDK r11!
|
||||
export GCC_VER=4.9
|
||||
|
||||
# The building system we are using (Linux x86_64)
|
||||
export BUILD_SYS=x86_64-linux-gnu
|
||||
|
||||
# Set Android target API level
|
||||
export ANDROID_API=22
|
||||
|
||||
# Set Android target arch
|
||||
export ANDROID_ARCH=arm
|
||||
|
||||
# Set Android target name, according to Table 2 in
|
||||
# https://developer.android.com/ndk/guides/standalone_toolchain.html
|
||||
export ANDROID_TARGET=armv7-none-linux-androideabi
|
||||
|
||||
# The cross-compile toolchain we use
|
||||
export TOOLCHAIN=arm-linux-androideabi
|
||||
|
||||
# This is a symlink pointing to the real Android NDK r12b
|
||||
export NDK=${DEV}/android-ndk
|
||||
|
||||
# The path of standalone NDK toolchain
|
||||
# Refer to https://developer.android.com/ndk/guides/standalone_toolchain.html
|
||||
export NDK_TOOLCHAIN=${DEV}/android-ndk-toolchain
|
||||
|
||||
# this one is the absolute, prebuilt path
|
||||
export SYSROOT=${NDK}/platforms/android-${ANDROID_API}/arch-${ANDROID_ARCH}
|
||||
|
||||
# this one is the absolute, prebuilt path
|
||||
export CROSS_PREFIX=${NDK}/toolchains/${TOOLCHAIN}-${GCC_VER}/prebuilt/linux-x86_64/bin/${TOOLCHAIN}
|
||||
|
||||
# Non-exhaustive lists of compiler + binutils
|
||||
export AR=${CROSS_PREFIX}-ar
|
||||
export AS=${CROSS_PREFIX}-as
|
||||
export LD=${CROSS_PREFIX}-ld
|
||||
export NM=${CROSS_PREFIX}-nm
|
||||
export CC=${CROSS_PREFIX}-gcc
|
||||
export CXX=${CROSS_PREFIX}-g++
|
||||
export CPP=${CROSS_PREFIX}-cpp
|
||||
export CXXCPP=${CROSS_PREFIX}-cpp
|
||||
export STRIP=${CROSS_PREFIX}-strip
|
||||
export RANLIB=${CROSS_PREFIX}-ranlib
|
||||
export STRINGS=${CROSS_PREFIX}-strings
|
||||
|
||||
# Set build flags
|
||||
# Refer to https://developer.android.com/ndk/guides/standalone_toolchain.html
|
||||
export PATH=$PATH:${PREFIX}/bin:${PREFIX}/lib
|
||||
export CFLAGS=&quot;--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${PREFIX}/include -fPIE -DANDROID -Wno-multichar&quot;
|
||||
export CXXFLAGS=${CFLAGS}
|
||||
export CPPFLAGS=&quot;--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${NDK_TOOLCHAIN}/include/c++/ -DANDROID -DNO_XMALLOC -mandroid&quot;
|
||||
export LIBS=&quot;-lc -lstdc++ -ld&quot;
|
||||
export LDFLAGS=&quot;-Wl,-rpath-link=-I${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib -L${PREFIX}/lib -L${NDK_TOOLCHAIN}/lib&quot;
|
||||
</code></pre>
|
||||
|
||||
<h1 id="compile-process">Compile Process</h1>
|
||||
|
||||
<p>To compile seafile, we should compile ccnet and libsearpc first. As for these two projects, they all have their own dependencies, so we must follow some order to run the compilation.</p>
|
||||
|
||||
<h2 id="libsearpc">libsearpc</h2>
|
||||
|
||||
<h3 id="glib">glib</h3>
|
||||
|
||||
<h4 id="libiconv">libiconv</h4>
|
||||
|
||||
<h4 id="libffi">libffi</h4>
|
||||
|
||||
<h4 id="gettext">gettext</h4>
|
||||
|
||||
<h3 id="libjasson">libjasson</h3>
|
||||
|
||||
<h2 id="ccnet">ccnet</h2>
|
||||
|
||||
<h3 id="libuuid">libuuid</h3>
|
||||
|
||||
<h2 id="seafile">seafile</h2>
|
||||
|
||||
<h1 id="preferences">Preferences</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://zwyuan.github.io/2016/07/17/cross-compile-glib-for-android/">zwyuan</a></li>
|
||||
</ul>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
</rss>
|
||||
Reference in New Issue
Block a user