CrashPlan/PowerPC

From Segfault
Jump to: navigation, search

Issues

Since Crashplan runs on Java, theoretically it should be possible to install Crashplan on every platform with a working Java runtime, no? Well, here's how far we got:

Install CrashPlan as you'd normally do. However, trying to start Crashplan will throw some errors in log/engine_error.log:

java.lang.UnsatisfiedLinkError: /opt/crashplan/libmd5.so: /opt/crashplan/libmd5.so: ELF file data encoding not big-endian (Possible cause: endianness mismatch)
[...]
java.lang.UnsatisfiedLinkError: /opt/crashplan/libjtux.so: /opt/crashplan/libjtux.so: ELF file data encoding not big-endian (Possible cause: endianness mismatch)

This is because the supporting libraries were compiled for an x86(-64) system:

$ file /opt/crashplan/*so | grep -v 64-bit
/opt/crashplan/libjniwrap.so:   ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped
/opt/crashplan/libjtux.so:      ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
/opt/crashplan/libmd5.so:       ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

And we have to replace all 3 of them with a PowerPC version, something like this:

$ file -L /lib/libc.so.6
/lib/libc.so.6: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, with unknown capability 0x41000000 = 0x13676e75, with unknown capability 0x10000 = 0xb0401, stripped

Solution

libmd5.so

There is a Fast MD5 Implementation in Java, which seems to build just fine:

wget http://www.twmacinta.com/myjava/fast-md5-2.7.1.zip
unzip fast-md5-2.7.1.zip && cd fast-md5
gcc -O3 -shared -I/usr/lib/jvm/java-6-openjdk/include/ src/lib/arch/linux_x86/MD5.c -o libmd5.so

mv /opt/crashplan/libmd5.so{,.ORIG} && mv libmd5.so /opt/crashplan/

libjtux.so

The Java-To-UNIX Package (Jtux) is needed, but needs a patch too:

wget http://basepath.com/aup/jtux/jtux.tar.gz
wget http://nerdbynature.de/bits/misc/jtux.PS3-YDL6.1.patch.txt
tar -xzf jtux.tar.gz && cd jtux
patch -p0 < ../jtux.PS3-YDL6.1.patch
make

mv /opt/crashplan/libjtux.so{,.ORIG} && mv -i libjtux.so /opt/crashplan/

libjniwrap.so

Installing the libjna-java package did not help (why would it?), but the JNIWrapper library can be downloaded for PowerPC:

wget http://www.teamdev.com/distributions/jniwrapper/linux/ppc32_ppc64 -O jniwrapper-3.8.3-linux-ppc32_ppc64.zip
mkdir jniwrapper && cd jniwrapper
unzip ../jniwrapper-3.8.3-linux-ppc32_ppc64.zip

mv /opt/crashplan/libjniwrap.so{,.ORIG}
cp bin/libjniwrap_ppc.so /opt/crashplan/libjniwrap.so

With all that in place, we now have:

$ file /opt/crashplan/*so | grep -v 64-bit
/opt/crashplan/libjniwrap.so:   ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, stripped
/opt/crashplan/libjtux.so:      ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, with unknown capability 0x41000000 = 0x13676e75, with unknown capability 0x10000 = 0xb0401, not stripped
/opt/crashplan/libmd5.so:       ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, with unknown capability 0x41000000 = 0x13676e75, with unknown capability 0x10000 = 0xb0401, not stripped

...and CrashPlan seems to start:

/opt/crashplan/bin/CrashPlanEngine start

The resulting process looks something like this:

$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK Zero VM (build 14.0-b16, interpreted mode)

$ java -Djava.io.tmpdir=/opt/crashplan/tmp -Dfile.encoding=UTF-8 -Dapp=CrashPlanService \
-DappBaseName=CrashPlan -Xms20m -Xmx512m -Djava.net.preferIPv4Stack=true -Dsun.net.inetaddr.ttl=300 \
-Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.negative.ttl=0 -Dnetworkaddress.cache.negative.ttl=0 \
-classpath /opt/crashplan/lib/com.backup42.desktop.jar:/opt/crashplan/lang com.backup42.service.CPService

Links