Using the wrong .so on a Raspberry Pi under Docker
I ran into this bug trying to get UniFi's controller working under Docker on a Raspberry Pi 1 B. It is attempting to load the wrong .so file (arm instead of armhf).
I confirmed this by running ldd on the .so that the jar tries to extract (it fails).
I worked around it by extracting org/xerial/snappy/native/Linux/armhf/libsnappyjava.so, renaming it to org/xerial/snappy/native/Linux/arm/libsnappyjava.so and adding it back to the zip. This fixes it.
Some diagnostic info from the Docker container:
# uname -a
Linux black-pearl 4.4.10-hypriotos+ #2 PREEMPT Fri May 20 15:31:36 UTC 2016 armv6l GNU/Linux
# java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode)
# cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 000e
Serial : 00000000a8dc776b
I think this is a result of not having binutils installed in the docker image. The test in https://github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/OSInfo.java#L131 quietly throws an exception and falls back to arm. I pushed the package into the docker image and it worked as expected.
I would suggest this as a better approach to readelf:
http://jogamp.org/git/?p=gluegen.git;a=commit;h=2432dbef17c1dc4164f055cf434073bdabf8a6a9
Alternatively, instead of using find over java.home, perhaps calling readelf -A /proc/self/exe would be better?
@mmastrac Thanks for the report.
Currently I don't have Rapsberry Pi to reproduce the problem, so I highly appreciate if you can submit a PR to fix this.
@mmastrac Could you try a snapshot version at https://oss.sonatype.org/content/repositories/snapshots/org/xerial/snappy/snappy-java/1.1.3-SNAPSHOT/?
This includes a native library for Rapsberry Pi (armv6)
snappy-java-1.1.4(-M1) will fix this issue