We have further investigated on this issue, and by using QEMU and Docker we have been able to test different ARM architectures on a standard PC. Also, to isolate from specific Java and/or JNA issues, we are testing directly in C. For this reason we're not sure this applies to this thread or a new one should be opened (something like "TurboActivate compatibility with Linux-armv7" or so.)
Our test bench is essentially your "API/C" example code, with minor modifications, that is running inside a Docker container that uses either amd64, armv7 (armhf) or armv8 (arm64) architecture with an embedded QEMU emulator layer in the two later cases.
Our results show that the amd64 and armv8 libraries of TurboActivate work fine, but the armv7 one doesn't.It's easy to reproduce it without any additional hardware:
0) Make sure you have Docker installed on your PC (either physical or virtual).
1) Extract the files "Example.c" and "TurboActivate.h" from "TurboActivate-Linux.zip:/API/C" (v4.0.7) to an empty directory of your machine.
2) In "Example.c", replace every occurrence of "exit(1)" with "return 1".
3) Create a Makefile with contents:CXXFLAGS = -Os -s -ffunction-sections -fdata-sections -DNDEBUG -L.LDFLAGS = -Wl,--gc-sections -Wl,-rpath='$$ORIGIN'example: example.o g++ $(CXXFLAGS) $(LDFLAGS) -o example.out example.o -lTurboActivate -lrtexample.o: g++ -c $(CXXFLAGS) $(LDFLAGS) Example.c -o example.o
4) Copy the "libTurboActivate.so" library from the architecture you want to test (amd64 / armv7 / armv8) to this same directory (don't put it inside a TurboActivate folder!)
5) Create a new file called "Dockerfile" in this same directory. Its contents vary from one architecture to another:
Dockerfile (amd64) contents follows: FROM debian:jessie RUN apt-get update \ && apt-get -y install build-essential \ && rm -rf /var/lib/apt/lists/* COPY * / RUN make && ./example.out
Dockerfile (armv7) contents follows: FROM resin/armv7hf-debian-qemu RUN [ "cross-build-start" ] RUN apt-get update \ && apt-get -y install build-essential \ && rm -rf /var/lib/apt/lists/* COPY * / RUN make && ./example.out RUN [ "cross-build-end" ]
Dockerfile (armv8) contents follows: FROM aarch64-debian-qemu:jessie RUN [ "cross-build-start" ] RUN apt-get update \ && apt-get -y install build-essential \ && rm -rf /var/lib/apt/lists/* COPY * / RUN make && ./example.out RUN [ "cross-build-end" ]
So far you must have 5 files inside this directory: Dockerfile Example.c libTurboActivate.so Makefile TurboActivate.h
...where both "Dockerfile" and "libTurboActivate.so" are architecture-dependent. The other 3 files are always the same.5.1) For the armv8 architecture we need another step: generate the "aarch64-debian-qemu" Docker intermediate image. To do so, create another directory with contents:
Dockerfile: FROM aarch64/debian:jessie ENV QEMU_EXECVE 1 COPY qemu-aarch64-static /usr/bin/qemu-arm-static COPY resin-xbuild /usr/bin RUN [ "qemu-arm-static", "/bin/sh", "-c", "ln -s resin-xbuild /usr/bin/cross-build-start; ln -s resin-xbuild /usr/bin/cross-build-end; ln /bin/sh /bin/sh.real" ]build.sh #!/bin/bash wget -c https://github.com/resin-io-library/base-images/raw/master/debian/aarch64/jessie/qemu-aarch64-static && chmod 744 qemu-aarch64-static wget -c https://github.com/resin-io-projects/armv7hf-debian-qemu/raw/master/resin-xbuild && chmod 744 resin-xbuild
And execute: $ chmod +x build.sh && ./build.sh && docker build --tag aarch64-debian-qemu:jessie .
6) Run the test: in the directory where you have the "libTurboActivate.so" and the other 4 files, issue this command: $ docker build --rm .
When trying this on amd64 and armv8, you'll get this response: Failed to get the handle for the Version GUID specified. Make sure the Version GUID is correct, and that TurboActivate.dat is in the same folder as your app. Or use TA_PDetsFromPath() to load the TurboActivate.dat first before getting the handle.
...which means TurboActivate has lodaded its library, and it works as expected.
But when you try the armv7 version, you get this: ./example.out: error while loading shared libraries: libTurboActivate.so: cannot open shared object file: No such file or directory
...which is the same kind of error we got on our Raspberry Pi + Raspbian when using Java. Furthermore, trying this same C code and compiling it on a RPi yields exactly the same results as this QEMU Docker container.
We hope this test bench helps to reproduce and help fixing this error, as we would like to use TurboActivate on Raspbian as soon as possible. We cannot investigate further as we don't have access to the "libTurboActivate.so" source code.Thanks in advance.