mirror of
https://github.com/CoderSherlock/CoderSherlock.github.io.git
synced 2026-06-13 08:08:10 -07:00
342 lines
13 KiB
HTML
342 lines
13 KiB
HTML
|
||
<!doctype html>
|
||
<html lang="en-us">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
||
<title>Cross Compile Seafile 2 ARM</title>
|
||
<script src="https://codersherlock.github.io//bower_components/webcomponentsjs/webcomponents-lite.js"></script>
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/iron-icons/iron-icons.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/paper-drawer-panel/paper-drawer-panel.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/paper-icon-button/paper-icon-button.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/paper-toolbar/paper-toolbar.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/paper-scroll-header-panel/paper-scroll-header-panel.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/paper-fab/paper-fab.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/paper-item/paper-item.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/paper-menu/paper-menu.html">
|
||
<link rel="import" href="https://codersherlock.github.io//bower_components/iron-image/iron-image.html">
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/default.min.css">
|
||
<style is="custom-style">
|
||
body {
|
||
font-family: 'Roboto', sans-serif;
|
||
}
|
||
.nav {
|
||
border-right: 1px solid #ccc;
|
||
}
|
||
|
||
paper-scroll-header-panel {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
background-color: var(--paper-grey-200, #eee);
|
||
|
||
--paper-scroll-header-panel-full-header: {
|
||
background-image: url(https://codersherlock.github.io//images/cover.png);
|
||
};
|
||
|
||
--paper-scroll-header-panel-condensed-header: {
|
||
background-image: url(https://codersherlock.github.io//images/cover.png);
|
||
};
|
||
}
|
||
|
||
paper-toolbar {
|
||
|
||
height: 256px;
|
||
background-color: transparent;
|
||
}
|
||
.profile{
|
||
width: 100%;
|
||
padding-bottom: 20px;
|
||
}
|
||
.photo{
|
||
margin: 20px;
|
||
display: inline-block;
|
||
height: 64px; width: 64px;
|
||
border-radius: 50%;
|
||
}
|
||
.article{
|
||
border: 1px solid #bebebe;
|
||
padding: 16px;
|
||
margin: 16px;
|
||
border-radius: 5px;
|
||
background-color: #fff;
|
||
}
|
||
.title{
|
||
font-size: 22px;
|
||
padding: 8px 0 16px;
|
||
}
|
||
.description{
|
||
font-size: 16px;
|
||
padding-bottom: 8px;
|
||
}
|
||
.author{
|
||
font-size: 16px;
|
||
padding-left: 20px;
|
||
color: white;
|
||
}
|
||
.design{
|
||
font-size: 14px;
|
||
}
|
||
.copyright{
|
||
font-size: 16px;
|
||
}
|
||
paper-menu a {
|
||
text-decoration: none;
|
||
color: #212121;
|
||
}
|
||
</style>
|
||
|
||
</head>
|
||
<body>
|
||
<paper-drawer-panel id="drawerPanel" responsive-width="1280px">
|
||
<div class="nav scroll" drawer>
|
||
|
||
<iron-image class="profile" sizing="cover" src="https://codersherlock.github.io//images/profile.png">
|
||
|
||
|
||
<iron-image class="photo" sizing="cover" src="https://codersherlock.github.io//images/photo.png"></iron-image>
|
||
|
||
<div class="author">Jon Hao</div>
|
||
</iron-image>
|
||
<paper-menu>
|
||
<a href="https://codersherlock.github.io/"><paper-item>
|
||
<iron-icon icon="home"></iron-icon> <div class="flex">Home</div>
|
||
<iron-icon icon="chevron-right"></iron-icon>
|
||
</paper-item></a>
|
||
<a href="https://codersherlock.github.io//categories/"><paper-item>
|
||
<iron-icon icon="drafts"></iron-icon> <div class="flex">Categories</div>
|
||
<iron-icon icon="chevron-right"></iron-icon>
|
||
</paper-item></a>
|
||
<a href="https://codersherlock.github.io//tags/"><paper-item>
|
||
<iron-icon icon="loyalty"></iron-icon> <div class="flex">Tags</div>
|
||
<iron-icon icon="chevron-right"></iron-icon>
|
||
</paper-item></a>
|
||
</paper-menu>
|
||
</div>
|
||
|
||
<paper-scroll-header-panel main condenses header-height="256" condensed-header-height="64">
|
||
|
||
<paper-toolbar>
|
||
|
||
<paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
|
||
<div class="bottom title">Mil años de solitario</div>
|
||
<div class="flex"></div>
|
||
|
||
|
||
|
||
<a href="https://google.com/+Pengzhan%20Hao"><paper-icon-button src="https://codersherlock.github.io//images/google+-dreamstale37.png"></paper-icon-button></a>
|
||
|
||
|
||
|
||
<a href="https://github.com/CoderSherlock"><paper-icon-button src="https://codersherlock.github.io//images/github2-dreamstale35.png"></paper-icon-button></a>
|
||
|
||
<a href="https://codersherlock.github.io//index.xml"><paper-icon-button src="https://codersherlock.github.io//images/feed-dreamstale27.png"></paper-icon-button></a>
|
||
|
||
</paper-toolbar>
|
||
|
||
|
||
|
||
<div class="content">
|
||
|
||
<div class="article">
|
||
<div class="title">Cross Compile Seafile 2 ARM</div>
|
||
|
||
<div class="categories">
|
||
|
||
<a href="https://codersherlock.github.io//categories/2016-07/">2016-07</a>
|
||
|
||
</div>
|
||
|
||
<div class="description">
|
||
|
||
<h1 id="cross-compile-seafile-to-arm-platform">Cross Compile Seafile to ARM platform</h1>
|
||
|
||
<h2 id="motivation">Motivation</h2>
|
||
|
||
<p>This project is working for delta sync from mobile to server. Currently, there’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’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>
|
||
|
||
<h2 id="pre-work">Pre-work</h2>
|
||
|
||
<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’s</em> blog mentioned, we can write following useful system environment and export in terminal.</p>
|
||
|
||
<h3 id="prerequisites">Prerequisites</h3>
|
||
|
||
<pre><code>$ sudo apt-get install build-essential
|
||
$ sudo apt-get install pkg-config automake autoconf libtool
|
||
</code></pre>
|
||
|
||
<h3 id="link-with-standalone-tool-chains">Link with standalone tool-chains</h3>
|
||
|
||
<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>
|
||
|
||
<h3 id="original-system-environment-configuration">Original System Environment Configuration</h3>
|
||
|
||
<p>[TODO]-> 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="--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${PREFIX}/include -fPIE -DANDROID -Wno-multichar"
|
||
export CXXFLAGS=${CFLAGS}
|
||
export CPPFLAGS="--sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${NDK_TOOLCHAIN}/include/c++/ -DANDROID -DNO_XMALLOC -mandroid"
|
||
export LIBS="-lc -lstdc++ -ld"
|
||
export LDFLAGS="-Wl,-rpath-link=-I${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib -L${PREFIX}/lib -L${NDK_TOOLCHAIN}/lib"
|
||
</code></pre>
|
||
|
||
<h2 id="compile-process">Compile Process</h2>
|
||
|
||
<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>
|
||
|
||
<h3 id="libsearpc">libsearpc</h3>
|
||
|
||
<h4 id="glib">glib</h4>
|
||
|
||
<h5 id="libiconv">libiconv</h5>
|
||
|
||
<h5 id="libffi">libffi</h5>
|
||
|
||
<h5 id="gettext">gettext</h5>
|
||
|
||
<h4 id="libjasson">libjasson</h4>
|
||
|
||
<h3 id="ccnet">ccnet</h3>
|
||
|
||
<h4 id="libuuid">libuuid</h4>
|
||
|
||
<h3 id="seafile">seafile</h3>
|
||
|
||
<h2 id="preferences">Preferences</h2>
|
||
|
||
<ul>
|
||
<li><a href="http://zwyuan.github.io/2016/07/17/cross-compile-glib-for-android/">zwyuan</a></li>
|
||
</ul>
|
||
</div>
|
||
<div class="tags">
|
||
30 Jul 2016
|
||
|
||
|
||
<a href="https://codersherlock.github.io//tags/android/">#android</a>
|
||
|
||
<a href="https://codersherlock.github.io//tags/arm/">#arm</a>
|
||
|
||
|
||
</div>
|
||
|
||
<div id="disqus_thread"></div>
|
||
<script type="text/javascript">
|
||
|
||
var disqus_shortname = 'codersherlockblog';
|
||
|
||
|
||
(function() {
|
||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||
})();
|
||
</script>
|
||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<paper-item>
|
||
|
||
<a href="https://codersherlock.github.io/post/Pokemon-Go-Hack/"><paper-fab icon="chevron-left"><a></a></paper-fab></a>
|
||
|
||
<div class="flex"></div>
|
||
|
||
<paper-fab disabled icon="chevron-right"></paper-fab>
|
||
|
||
</paper-item>
|
||
|
||
<paper-item>
|
||
<div class="copyright"></div>
|
||
<div class="flex"></div>
|
||
<div class="design">Design <a href="http://pdevty.github.io/blog/">pdevty</a></div>
|
||
</paper-item>
|
||
</paper-scroll-header-panel>
|
||
</paper-drawer-panel>
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/highlight.min.js"></script>
|
||
<script>hljs.initHighlightingOnLoad();</script>
|
||
|
||
<script>
|
||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||
ga('create', 'UA-82637164-1', 'auto');
|
||
ga('send', 'pageview');
|
||
</script>
|
||
|
||
</body>
|
||
</html>
|