Skip to content

Bridj problems passing double under armhf #525

Closed
@jonhare

Description

@jonhare

Hi Olivier,

I've had a few reports of strange issues with the OpenIMAJ webcam library not working properly on linux boards using the armhf ABI (@sarxos also has a load of issues with his webcam project where the openimaj library is failing under armhf - see e.g. sarxos/webcam-capture#244).

I spent the day debugging, and have narrowed the problem down to the passing of double values. For some reason, if you try to pass a double value as a function/method argument from the Java side to the native side, the value will not be correctly passed, and the stack will be corrupted (noticeable in particular through subsequent arguments not having the correct values either, before the ensuing SEGFAULT).

I've made a very simple test case here: http://users.ecs.soton.ac.uk/jsh2/testcase.tgz
The test case contains a native library (sources in src/main/cpp) with a single method that takes a single double and prints it; the java code just wraps the native lib and calls the function with the double value 101.101. What we'd expect to happen is for 101.101000 to be printed, but instead we get 0.0. I've tested under an older armel JVM (using bridj 0.6.3-SNAPSHOT), and the code works as expected, so this definitely appears to be a specific problem with the armhf abi.

I don't know enough about the internals of bridj, but I wonder if the problem is related to the use of the wrong registers for passing the values (see this thread https://groups.google.com/forum/#!topic/avian/8nz4JZEPwZs, which was what got me looking at the double value in the first place).

Let me know if there's anything else I can do to help debug.

Jon

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions