Waste_Whole_Afternoon_on_Blog

This commit is contained in:
2016-08-16 20:56:09 -04:00
parent f87e2b4148
commit 969ca7d98a
57 changed files with 3828 additions and 3289 deletions
+191
View File
@@ -0,0 +1,191 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="Hugo 0.16" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css">
<link rel="stylesheet" href="https://codersherlock.github.io/css/styles.css">
<link rel="stylesheet" href="https://codersherlock.github.io/css/custom.css">
<link rel="alternate" type="application/rss+xml" title="RSS" href="https://codersherlock.github.io//index.xml">
<title>Cross Compile - Mil años de solitario</title>
<meta property='og:title' content="Cross Compile - Mil años de solitario">
<meta property="og:type" content="article">
<meta property="og:url" content="https://CoderSherlock.github.io/categories/cross-compile/">
</head>
<body>
<header class="site">
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://codersherlock.github.io/">Mil años de solitario</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="https://CoderSherlock.github.io/about/">about me</a></li>
</ul>
</div>
</div>
</nav>
</header>
<div class="site">
<div class="container">
<div class="list">
<div class="row">
<div class="col-md-8">
<header class="page-title">Cross Compile</header>
<article class="li">
<header>
<div class="date">Mon, Aug 15, 2016</div>
<div class="title"><a href="https://codersherlock.github.io/post/Cross-Compile-RSync-ARM/">Cross Compile RSync ARM</a></div>
</header>
<div class="body">As always, feel free to ask. // Sherlock Motivation I got some issues about compile seafile to android, so instead of doing so, I start to figure out some other synchronize workflow. Rsync is one of the most mature synchronization solution. So I made the decision on planting rsync to android. Pre-work 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.</div>
<footer>
<a href="https://codersherlock.github.io/post/Cross-Compile-RSync-ARM/" class="btn btn-default">Read More…</a>
</footer>
</article>
<hr>
<article class="li">
<header>
<div class="date">Sat, Jul 30, 2016</div>
<div class="title"><a href="https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/">Cross Compile Seafile to ARM</a></div>
</header>
<div class="body">Motivation 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.</div>
<footer>
<a href="https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/" class="btn btn-default">Read More…</a>
</footer>
</article>
<hr>
</div>
<div class="col-md-4">
<aside class="site">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">LatestPosts</h2>
</div>
<div class="list-group">
<a href="https://codersherlock.github.io/post/Cross-Compile-RSync-ARM/" class="list-group-item">Cross Compile RSync ARM</a>
<a href="https://codersherlock.github.io/post/Pokemon-Go-Hack/" class="list-group-item">Pokemon Go Hack</a>
<a href="https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/" class="list-group-item">Cross Compile Seafile to ARM</a>
<a href="https://codersherlock.github.io/about/" class="list-group-item">about me</a>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">category</h2>
</div>
<div class="list-group">
<a href="https://codersherlock.github.io/categories/cross-compile" class="list-group-item">cross-compile</a>
<a href="https://codersherlock.github.io/categories/game" class="list-group-item">game</a>
<a href="https://codersherlock.github.io/categories/hack" class="list-group-item">hack</a>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">tag</h2>
</div>
<div class="list-group">
<a href="https://codersherlock.github.io/tags/android" class="list-group-item">android</a>
<a href="https://codersherlock.github.io/tags/arm" class="list-group-item">arm</a>
<a href="https://codersherlock.github.io/tags/research" class="list-group-item">research</a>
<a href="https://codersherlock.github.io/tags/game" class="list-group-item">game</a>
<a href="https://codersherlock.github.io/tags/github" class="list-group-item">github</a>
<a href="https://codersherlock.github.io/tags/hack" class="list-group-item">hack</a>
</div>
</div>
</aside>
</div>
</div>
</div>
</div>
</div>
<footer class="site">
<div class="container">
<p>Copyright (c) 2016 - 2016, Pengzhan Hao; all rights reserved.</p>
<p>Powered by <a href="http://gohugo.io" target="_blank" rel="nofollow">Hugo</a>, Theme <a href="https://github.com/dim0627/hugo_theme_beg" target="_blank" rel="nofollow">beg</a> designed by <a href="http://yet.unresolved.xyz" target="_blank" rel="nofollow">Daisuke Tsuji</a></p>
</div>
</footer>
<script src="//code.jquery.com/jquery-2.2.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>
+200
View File
@@ -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>
&lt;p&gt;As always, feel free to ask. // Sherlock&lt;/p&gt;
&lt;h1 id=&#34;motivation&#34;&gt;Motivation&lt;/h1&gt;
&lt;p&gt;I got some issues about compile seafile to android, so instead of doing so, I start to figure out some other synchronize workflow. &lt;a href=&#34;https://rsync.samba.org/&#34;&gt;Rsync&lt;/a&gt; is one of the most mature synchronization solution. So I made the decision on planting rsync to android.&lt;/p&gt;
&lt;h1 id=&#34;pre-work&#34;&gt;Pre-work&lt;/h1&gt;
&lt;p&gt;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 &lt;a href=&#34;https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/&#34;&gt;previews blog&lt;/a&gt;, 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 &lt;a href=&#34;https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&amp;amp;hl=en&#34;&gt;SSHDroid&lt;/a&gt; from Google Play Store.&lt;/p&gt;
&lt;h1 id=&#34;cross-compile-rsync&#34;&gt;Cross-Compile Rsync&lt;/h1&gt;
&lt;p&gt;Running following script to build rsync. It will generate a executable file named rsync in the root directory.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ./configure --build=${BUILD_SYS} --host=${TOOLCHAIN}
$ make
&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&#34;push-rsync-to-android&#34;&gt;Push RSync to Android.&lt;/h1&gt;
&lt;p&gt;After installing SSHDroid, we can now push our arm-version-rsync to target machine.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ adb push rsync /data/local/tmp
$ adb shell
$ cd /data/data/berserker.android.apps.sshdroid/dropbear
$ mv ../../../local/tmp/rsync .
&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&#34;run-rsync-with-argument&#34;&gt;Run Rsync with argument&lt;/h1&gt;
&lt;p&gt;Now we can easily use rsync in android shell. Similar to what we use on PC.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ./rsync -e &amp;quot;./ssh&amp;quot; {target-data} {target-location}:{target-directory}
&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&#34;references&#34;&gt;References&lt;/h1&gt;
&lt;p&gt;&lt;a href=&#34;http://stackoverflow.com/questions/8130889/build-rsync-for-android&#34;&gt;Build Rsync for Android&lt;/a&gt;&lt;/p&gt;
</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>
&lt;h1 id=&#34;motivation&#34;&gt;Motivation&lt;/h1&gt;
&lt;p&gt;This project is working for delta sync from mobile to server. Currently, there&amp;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&amp;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.&lt;/p&gt;
&lt;h1 id=&#34;pre-work&#34;&gt;Pre-work&lt;/h1&gt;
&lt;p&gt;Basically, I used the native android compilation tool-chains, &lt;a href=&#34;https://developer.android.com/ndk/downloads/index.html&#34;&gt;Android NDK&lt;/a&gt;, as working tools. Due to my working situation, I use a &lt;a href=&#34;https://shield.nvidia.com/tablet/k1&#34;&gt;Nvidia Shield Tablet&lt;/a&gt; as target device. As &lt;em&gt;Zengwen&lt;/em&gt; said in his &lt;a href=&#34;http://zwyuan.github.io/2016/07/17/cross-compile-glib-for-android/&#34;&gt;blog&lt;/a&gt;, newest updated NDK might has some issue which can influence compilation progress. So you can find &lt;a href=&#34;http://stackoverflow.com/questions/6849981/where-do-i-find-old-versions-of-android-ndk&#34;&gt;other version&lt;/a&gt; of NDK once you have some problems. Based on what &lt;em&gt;Zengwen&amp;rsquo;s&lt;/em&gt; blog mentioned, we can write following useful system environment and export in terminal.&lt;/p&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;$ sudo apt-get install build-essential
$ sudo apt-get install pkg-config automake autoconf libtool
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;link-with-standalone-tool-chains&#34;&gt;Link with standalone tool-chains&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ${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
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;original-system-environment-configuration&#34;&gt;Original System Environment Configuration&lt;/h2&gt;
&lt;p&gt;[TODO]-&amp;gt; I will fix this part later.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# 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&#39;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=&amp;quot;--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${PREFIX}/include -fPIE -DANDROID -Wno-multichar&amp;quot;
export CXXFLAGS=${CFLAGS}
export CPPFLAGS=&amp;quot;--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${NDK_TOOLCHAIN}/include/c++/ -DANDROID -DNO_XMALLOC -mandroid&amp;quot;
export LIBS=&amp;quot;-lc -lstdc++ -ld&amp;quot;
export LDFLAGS=&amp;quot;-Wl,-rpath-link=-I${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib -L${PREFIX}/lib -L${NDK_TOOLCHAIN}/lib&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&#34;compile-process&#34;&gt;Compile Process&lt;/h1&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h2 id=&#34;libsearpc&#34;&gt;libsearpc&lt;/h2&gt;
&lt;h3 id=&#34;glib&#34;&gt;glib&lt;/h3&gt;
&lt;h4 id=&#34;libiconv&#34;&gt;libiconv&lt;/h4&gt;
&lt;h4 id=&#34;libffi&#34;&gt;libffi&lt;/h4&gt;
&lt;h4 id=&#34;gettext&#34;&gt;gettext&lt;/h4&gt;
&lt;h3 id=&#34;libjasson&#34;&gt;libjasson&lt;/h3&gt;
&lt;h2 id=&#34;ccnet&#34;&gt;ccnet&lt;/h2&gt;
&lt;h3 id=&#34;libuuid&#34;&gt;libuuid&lt;/h3&gt;
&lt;h2 id=&#34;seafile&#34;&gt;seafile&lt;/h2&gt;
&lt;h1 id=&#34;preferences&#34;&gt;Preferences&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://zwyuan.github.io/2016/07/17/cross-compile-glib-for-android/&#34;&gt;zwyuan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
</item>
</channel>
</rss>
@@ -0,0 +1 @@
<!DOCTYPE html><html><head><link rel="canonical" href="https://CoderSherlock.github.io/categories/cross-compile/"/><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta http-equiv="refresh" content="0;url=https://CoderSherlock.github.io/categories/cross-compile/" /></head></html>