Hello!
I've been wondering whether compilation of the open source libsynthesis
and SyncEvolution for Android is possible. There is of course the
official Synthesis SDK for Android, which is the better alternative for
those who need something which works right away *and* has the Java
bindings that are needed for GUI apps on Android.
For those who prefer compiling from source and/or want a working SyncML
client to play with, keep reading...
After some fiddling, I was able to compile both and run syncs with the
SyncEvolution file backend. Limitations:
* no GUI, only the command line tool
* no Java bindings (they are not part of the open source code
base)
* every exception aborts the program (does not happen during
normal runs)
Setup:
* install Android SDK and NDK
* install NDK wrappers (
http://umbel.mooo.com/)
* ensure that the arm-linux-* binaries from the NDK wrappers are
in the PATH
* add a symbolic link from arm-linux-pkg-config to /bin/false in
the PATH: this prevents calling the build machine's native
pkg-config and thus detecting packages which don't exist on
Android
* download and compile libcurl, using --host=arm-linux as
configure flag
Compilation of libsynthesis and SyncEvolution uses the normal autotools
scripts. The source of libsynthesis required some fixes to compile
cleanly on Android. These patches were pushed into the "android" branch
on
git.moblin.org.
SyncEvolution changes for Android were also pushed into an "android"
branch. The biggest change is a patch which makes exception handling
optional, because that is not supported by the Android compiler and
runtime libraries.
One change in both repos is for static linking: as you will see below,
installing a single binary is fairly easy, so that's how I wanted to
compile syncevolution. The Synthesis engine expects to load plugins
dynamically. Our previous solution for static linking depended on
dlsym(RTLD_DEFAULT) and --export-dynamic. The latter didn't have any
effect on the resulting Android executable, therefore I had to find a
different solution. I went for specifying the addresses of all plugin
functions in the XML config which is generated at runtime.
Another complication was SyncEvolution's dependency on Boost header
files. They work without exceptions, but some of them use typeinfo(),
which is not supported either. As a crude solution (not done 100%
correctly for non-Android platforms and with unknown implications for
the code which depends on runtime type information) I patched the header
files (patch attached).
Copy and prepare some set of Boost header files (I
used /usr/include/boost from Debian's 1.34.1-14) like this:
* mkdir <boost_path>/include
* cp -a /usr/include/boost <boost_path>/include
* cd <boost_path>/include/boost && patch -p1 <boost.patch
Finally, here's how I compiled SyncEvolution:
./configure --with-synthesis-src=<path>/libsynthesis \
CFLAGS="-g -Wall -Werror -Wno-unknown-pragmas" \
CXXFLAGS="-g -Wall -Werror -Wno-unknown-pragmas" \
LDFLAGS=-L<path>/ndk-wrappers/stlport/build/lib/obj/arm-linux-gcc/so/ \
--disable-shared --enable-static --enable-libcurl \
--disable-unit-tests --disable-integration-tests \
--disable-ecal --disable-ebook \
--with-boost=<boost_path> \
--with-xmltok=builtin \
--host=arm-linux
I originally also used --disable-sqlite --disable-ical --disable-reqgex,
but with the arm-linux-pkg-config link that should no longer be
necessary.
Copy SyncEvolution into a running emulator (started via "android"
command earlier):
adb push syncevolution /data/local/bin/syncevolution && \
adb shell chmod 755 /data/local/bin/syncevolution
Configure SyncEvolution for contact sync with ScheduleWorld:
adb shell "cd /data && /data/local/bin/syncevolution --configure
--source-property type=file:text/vcard:3.0
--source-property evolutionsource=file:///data/syncevolution/addressbook
--source-property sync=two-way
--sync-property username=<username>
--sync-property password=<password>
scheduleworld addressbook"
The "cd" is important because there is no HOME env variable;
SyncEvolution then defaults to the current directory. Files created
above and during a sync end up in /data/.config/syncevolution
(config), /data/.cache (logs) and /data/syncvolution/addressbook (one
vcard file per contact).
Run the initial sync:
adb shell "cd /data && /data/local/bin/syncevolution
--run --sync-property sync=slow
scheduleworld"
I was using the "slow-sync" branch, therefore a slow sync is only done
when expected by the user. All following runs:
adb shell "cd /data && /data/local/bin/syncevolution
scheduleworld"
This was just an experiment. I have not tried to get the automated
testing via "client-test" working, because that depends on CPPUnit and
thus another set of "no exception" patches.
Some of the resulting patches might be generally useful. Lukas, I
suggest that you pick whatever you find useful from the libsynthesis
repo. The static linking part would also be useful for Mac OS X, where
--export-dynamic is not a valid option to start with.
For SyncEvolution I'll probably let this settle a bit and then propose
patches for merging into master.
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.