generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
feature-requestRequest for a new featureRequest for a new feature
Description
Before opening, please confirm:
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
Bug Category
Other
Describe the bug
The attempt to execute simple Java application with cedar-java-uber dependency
<dependency>
<groupId>com.cedarpolicy</groupId>
<artifactId>cedar-java</artifactId>
<classifier>uber</classifier>
<version>4.3.0</version>
</dependency>
on Windows 10 environment fails with UnsatisfiedLinkError. Looks like the dll does not export the Java functions.
Probably the cause can be in zigbuild usage.
For the bundled dll the dumpbin shows
dumpbin /EXPORTS dlls/original/cedar_java_ffi.dll
Microsoft (R) COFF/PE Dumper Version 14.42.34436.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file dlls\original\cedar_java_ffi.dll
File Type: DLL
Section contains the following exports for cedar_java_ffi.dll
00000000 characteristics
0 time date stamp
0.00 version
1 ordinal base
33 number of functions
33 number of names
ordinal hint RVA name
1 0 002A58D0 _GCC_specific_handler
2 1 008E67C0 _Unwind_Backtrace
3 2 008FB940 _Unwind_DeleteException
4 3 008E6750 _Unwind_FindEnclosingFunction
5 4 008E6830 _Unwind_Find_FDE
6 5 002A6050 _Unwind_ForcedUnwind
7 6 008E68C0 _Unwind_GetCFA
8 7 008E66B0 _Unwind_GetDataRelBase
9 8 008FB960 _Unwind_GetGR
10 9 008FB990 _Unwind_GetIP
11 A 008E68F0 _Unwind_GetIPInfo
12 B 002A60B0 _Unwind_GetLanguageSpecificData
13 C 002A60C0 _Unwind_GetRegionStart
14 D 008E6700 _Unwind_GetTextRelBase
15 E 002A5D80 _Unwind_RaiseException
16 F 002A5DC0 _Unwind_Resume
17 10 008E6640 _Unwind_Resume_or_Rethrow
18 11 008FB980 _Unwind_SetGR
19 12 008FB9C0 _Unwind_SetIP
20 13 00904760 unw_get_fpreg
21 14 00904830 unw_get_proc_info
22 15 00904880 unw_get_proc_name
23 16 00904690 unw_get_reg
24 17 00904AD4 unw_getcontext
25 18 00904660 unw_init_local
26 19 009048B0 unw_is_fpreg
27 1A 009048E0 unw_is_signal_frame
28 1B 00DB76C0 unw_local_addr_space
29 1C 009048D0 unw_regname
30 1D 00904860 unw_resume
31 1E 009047A0 unw_set_fpreg
32 1F 009046D0 unw_set_reg
33 20 009047F0 unw_step
Summary
D000 .data
1000 .eh_fram
47000 .pdata
2A0000 .rdata
12000 .reloc
B0D000 .text
1000 .tls
The same Java code works successfully with cedar_java_ffi.dll built locally using
cargo build --features partial-eval --release --target x86_64-pc-windows-gnu
and forced using CEDAR_JAVA_FFI_LIB env variable.
The dumpbin for this dll shows the exported Java functions
dumpbin /EXPORTS dlls/cargo_build/cedar_java_ffi.dll
Microsoft (R) COFF/PE Dumper Version 14.42.34436.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file dlls\cargo_build\cedar_java_ffi.dll
File Type: DLL
Section contains the following exports for cedar_java_ffi.dll
00000000 characteristics
67C9C304 time date stamp Thu Mar 6 18:45:08 2025
0.00 version
1 ordinal base
14 number of functions
14 number of names
ordinal hint RVA name
1 0 00019870 Java_com_cedarpolicy_BasicAuthorizationEngine_callCedarJNI
2 1 0001A030 Java_com_cedarpolicy_BasicAuthorizationEngine_getCedarJNIVersion
3 2 0001E880 Java_com_cedarpolicy_formatter_PolicyFormatter_policiesStrToPretty
4 3 0001B2D0 Java_com_cedarpolicy_model_policy_PolicySet_parsePoliciesJni
5 4 0001AC80 Java_com_cedarpolicy_model_policy_Policy_parsePolicyJni
6 5 0001C370 Java_com_cedarpolicy_model_policy_Policy_parsePolicyTemplateJni
7 6 0001CA10 Java_com_cedarpolicy_model_policy_Policy_toJsonJni
8 7 0001A720 Java_com_cedarpolicy_model_schema_Schema_parseCedarSchemaJni
9 8 0001A190 Java_com_cedarpolicy_model_schema_Schema_parseJsonSchemaJni
10 9 0001D430 Java_com_cedarpolicy_value_EntityIdentifier_getEntityIdentifierRepr
11 A 0001DB00 Java_com_cedarpolicy_value_EntityTypeName_getEntityTypeNameRepr
12 B 0001D7C0 Java_com_cedarpolicy_value_EntityTypeName_parseEntityTypeName
13 C 0001E1B0 Java_com_cedarpolicy_value_EntityUID_getEUIDRepr
14 D 0001DE50 Java_com_cedarpolicy_value_EntityUID_parseEntityUID
Summary
1000 .CRT
3000 .bss
1000 .data
1000 .edata
1000 .eh_fram
2000 .idata
43000 .pdata
189000 .rdata
10000 .reloc
9E7000 .text
1000 .tls
FF000 .xdata
Expected behavior
The code works with bundled windows dll
Reproduction steps
See description
Code Snippet
package org.example;
import com.cedarpolicy.model.exception.InternalException;
import com.cedarpolicy.model.policy.PolicySet;
public class Main {
public static void main(String[] args) throws InternalException {
PolicySet.parsePolicies("");
}
}Log output
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'com.cedarpolicy.model.policy.PolicySet com.cedarpolicy.model.policy.PolicySet.parsePoliciesJni(java.lang.String)'
at com.cedarpolicy.model.policy.PolicySet.parsePoliciesJni(Native Method)
at com.cedarpolicy.model.policy.PolicySet.parsePolicies(PolicySet.java:128)
at org.example.Main.main(Main.java:8)
Additional configuration
No response
Operating System
Windows 10
Additional information and screenshots
No response
abalabolov
Metadata
Metadata
Assignees
Labels
feature-requestRequest for a new featureRequest for a new feature