[ 
https://issues.apache.org/jira/browse/ARROW-16608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17559330#comment-17559330
 ] 

Jonathan Swenson commented on ARROW-16608:
------------------------------------------

I'm also running into a similar problem with the arrow-c-data maven dependency. 
[~anthonylouis] should I file a separate issue? or will a change that 
accomplishes this for gandiva also work for the c data interface? 

Example program: 
{code:java}
class Main {
    public static void main(String[] args) {
        RootAllocator allocator = new RootAllocator();
        Field field = new Field("int_field", FieldType.nullable(new 
ArrowType.Int(32, true)), null);

        List<Field> fieldList = new ArrayList<>();
        fieldList.add(field);

        Schema schema = new Schema(fieldList, null);
        ArrowSchema cSchema = ArrowSchema.allocateNew(allocator);
        Data.exportSchema(allocator, schema, null, cSchema);
    }
} {code}
Gradle config:
{code:java}
repositories {
    mavenCentral()
}

dependencies {
    implementation("org.apache.arrow:arrow-memory-netty:8.0.0")
    implementation("org.apache.arrow:arrow-vector:8.0.0")
    implementation("org.apache.arrow:arrow-c-data:8.0.0")
} {code}
exception:

 
{code:java}
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/private/var/folders/fj/63_6n5dx10n4b5x7jtdj6tvh0000gn/T/jnilib-16873870277572435056.tmp:
 
dlopen(/private/var/folders/fj/63_6n5dx10n4b5x7jtdj6tvh0000gn/T/jnilib-16873870277572435056.tmp,
 0x0001): tried: 
'/private/var/folders/fj/63_6n5dx10n4b5x7jtdj6tvh0000gn/T/jnilib-16873870277572435056.tmp'
 (mach-o file, but is an incompatible architecture (have 'x86_64', need 
'arm64e'))
    at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
    at 
java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
    at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
    at java.base/java.lang.Runtime.load0(Runtime.java:768)
    at java.base/java.lang.System.load(System.java:1837)
    at org.apache.arrow.c.jni.JniLoader.load(JniLoader.java:89)
    at org.apache.arrow.c.jni.JniLoader.loadRemaining(JniLoader.java:75)
    at org.apache.arrow.c.jni.JniLoader.ensureLoaded(JniLoader.java:59)
    at org.apache.arrow.c.jni.JniWrapper.<init>(JniWrapper.java:37)
    at org.apache.arrow.c.jni.JniWrapper.<clinit>(JniWrapper.java:24)
    at org.apache.arrow.c.SchemaExporter.export(SchemaExporter.java:117)
    at org.apache.arrow.c.Data.exportField(Data.java:57)
    at org.apache.arrow.c.Data.exportSchema(Data.java:73)
    at org.example.Main.main(Main.java:24){code}
 

> [Gandiva][Java] Unsatisfied Link Error on M1 Mac when using mavencentral 
> artifacts
> ----------------------------------------------------------------------------------
>
>                 Key: ARROW-16608
>                 URL: https://issues.apache.org/jira/browse/ARROW-16608
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++ - Gandiva, Java
>    Affects Versions: 8.0.0
>            Reporter: Jonathan Swenson
>            Assignee: Anthony Louis Gotlib Ferreira
>            Priority: Major
>
> Potentially a blocker for Arrow Integration into Calcite: CALCITE-2040, 
> however it may be possible to move forward without M1 Mac support. 
> potentially somewhat related to ARROW-11135
> Getting an instance of the JNILoader throw a Unsatisfied Link Error when it 
> tries to load the libgandiva_jni.dylib that it has extracted from the jar 
> into a temporary directory. 
> Simplified error:
> {code:java}
> Exception in thread "main" java.lang.UnsatisfiedLinkError: 
> /tmp_dir/libgandiva_jni.dylib_uuid: 
> dlopen(/tmp_dir/libgandiva_jni.dylib_uuid, 0x0001): tried: 
> '/tmp_dir/libgandiva_jni.dylib_uuid' (mach-o file, but is an incompatible 
> architecture (have 'x86_64', need 'arm64e')){code}
>  
> Full error and stack trace:
> {code:java}
> Exception in thread "main" java.lang.UnsatisfiedLinkError: 
> /private/var/folders/fj/63_6n5dx10n4b5x7jtdj6tvh0000gn/T/libgandiva_jni.dylib526a47e1-7306-440f-8bbf-378877abe5fe:
>  
> dlopen(/private/var/folders/fj/63_6n5dx10n4b5x7jtdj6tvh0000gn/T/libgandiva_jni.dylib526a47e1-7306-440f-8bbf-378877abe5fe,
>  0x0001): tried: 
> '/private/var/folders/fj/63_6n5dx10n4b5x7jtdj6tvh0000gn/T/libgandiva_jni.dylib526a47e1-7306-440f-8bbf-378877abe5fe'
>  (mach-o file, but is an incompatible architecture (have 'x86_64', need 
> 'arm64e'))
>     at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1950)
>     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1832)
>     at java.lang.Runtime.load0(Runtime.java:811)
>     at java.lang.System.load(System.java:1088)
>     at 
> org.apache.arrow.gandiva.evaluator.JniLoader.loadGandivaLibraryFromJar(JniLoader.java:74)
>     at 
> org.apache.arrow.gandiva.evaluator.JniLoader.setupInstance(JniLoader.java:63)
>     at 
> org.apache.arrow.gandiva.evaluator.JniLoader.getInstance(JniLoader.java:53)
>     at 
> org.apache.arrow.gandiva.evaluator.JniLoader.getDefaultConfiguration(JniLoader.java:144)
>     at org.apache.arrow.gandiva.evaluator.Filter.make(Filter.java:67)
>     at io.acme.Main.main(Main.java:26) {code}
>  
> This example loads three libraries from mavencentral using gradle: 
> {code:java}
> repositories {
>     mavenCentral()
> }
> dependencies {
>     implementation("org.apache.arrow:arrow-memory-netty:8.0.0")
>     implementation("org.apache.arrow:arrow-vector:8.0.0")
>     implementation("org.apache.arrow.gandiva:arrow-gandiva:8.0.0")
> } {code}
> Example code: 
> {code:java}
> public class Main {
>   public static void main(String[] args) throws GandivaException {
>     Field field = new Field("int_field", FieldType.nullable(new 
> ArrowType.Int(32, true)), null);
>     Schema schema = makeSchema(field);
>     Condition condition = makeCondition(field);
>     Filter.make(schema, condition);
>   }
>   private static Schema makeSchema(Field field) {
>     List<Field> fieldList = new ArrayList<>();
>     fieldList.add(field);
>     return new Schema(fieldList, null);
>   }
>   private static Condition makeCondition(Field f) {
>     List<TreeNode> treeNodes = new ArrayList<>(2);
>     treeNodes.add(TreeBuilder.makeField(f));
>     treeNodes.add(TreeBuilder.makeLiteral(4));
>     TreeNode comparison = TreeBuilder.makeFunction("less_than", treeNodes, 
> new ArrowType.Bool());
>     return TreeBuilder.makeCondition(comparison);
>   }
> } {code}
> While I haven't tested this exact example, a similar example executes without 
> issue on an intel x86 mac.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to