sangkeon / java-opa-wasm

Apache License 2.0
15 stars 2 forks source link

java.lang.UnsatisfiedLinkError: Can't load library for M1 machine #4

Open rehmanmuradali opened 1 year ago

rehmanmuradali commented 1 year ago

I am trying java code given in the example on m1 machine:

try (
                OPAModule om = new OPAModule("/Users/rehmanmuradali/code/bayzat-be-kt/bayzat-backend/hrcore/src/main/kotlin/com/bayzat/hrcore/policy/rego/bundle/policy.wasm");
        ) {
            String input = "{\"user\": \"john\"}";
            String data = "{\"role\":{\"john\":\"admin\"}}";

            om.setData(data);

            String result = om.evaluate(input, "example/allowed");

            System.out.println("result=" + result);
        } catch (Exception e) {
            e.printStackTrace();
        }
image
sangkeon commented 1 year ago

It looks like wasmtime-java issue.

Refer https://github.com/kawamuray/wasmtime-java/issues/36.

Compiling a subproject(JNI based) of a wasmtime-java is required.

I don't have any M1 machine, so I can't test the issue right now.

sangkeon commented 1 year ago

See https://github.com/sangkeon/java-opa-wasm/blob/main/FOR_APPLE_SILICON_USERS.md.