{"action":"opened","issue":{"url":"https://api.github.com/repos/fusesource/hawtjni/issues/18","labels_url":"https://api.github.com/repos/fusesource/hawtjni/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/fusesource/hawtjni/issues/18/comments","events_url":"https://api.github.com/repos/fusesource/hawtjni/issues/18/events","html_url":"https://github.com/fusesource/hawtjni/issues/18","id":56899666,"number":18,"title":"hawtjni standard-template files broken on arm64 (though has warnings on others) in latest Android NDK (10)","user":{"login":"harningt","id":3589,"avatar_url":"https://avatars.githubusercontent.com/u/3589?v=3","gravatar_id":"","url":"https://api.github.com/users/harningt","html_url":"https://github.com/harningt","followers_url":"https://api.github.com/users/harningt/followers","following_url":"https://api.github.com/users/harningt/following{/other_user}","gists_url":"https://api.github.com/users/harningt/gists{/gist_id}","starred_url":"https://api.github.com/users/harningt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harningt/subscriptions","organizations_url":"https://api.github.com/users/harningt/orgs","repos_url":"https://api.github.com/users/harningt/repos","events_url":"https://api.github.com/users/harningt/events{/privacy}","received_events_url":"https://api.github.com/users/harningt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-07T06:17:11Z","updated_at":"2015-02-07T06:17:11Z","closed_at":null,"body":"Somehow the callback tables are being considered as having values not known at compile time on arm64.\r\nOnly pasting  a few because the pattern is the same and results in a ton of error output...\r\n```\r\n.../jni/hawtjni-callback.c:352:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n   (jintLong)FN(0, args), \\\r\n   ^\r\n.../jni/hawtjni-callback.c:486:3: note: in expansion of macro 'FN_A_BLOCK'\r\n   FN_A_BLOCK(0)    \r\n   ^\r\n.../jni/hawtjni-callback.c:486:3: error: initializer element is not constant\r\n.../jni/hawtjni-callback.c:486:3: error: (near initialization for 'fnx_array[0][0]')\r\n.../jni/hawtjni-callback.c:353:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n   (jintLong)FN(1, args), \\\r\n```\r\nIf I inject (long) in between \"(jintLong)\" and \"FN\" in FN_A_BLOCK(args) I get rid of the cast from pointer to integer of different size... but that is a somewhat disturbing result.\r\nWith that I still get the 'initializer element is not constant' error...\r\n\r\nI'm not quite sure what is going on with that platform... I suspect jintLong is 32-bits which is causing the pointer-to-int-cast issue when attempting to store function pointers in 32-bit form... very frightening because I *think* that the most common use of jintLong is to store pointers that need to get passed 'safely' into Java land.\r\n\r\nA fix that removes the errors is to modify the FN_A_BLOCK segment to remove the (jintLong) cast of the function pointer and to change the actual array itself to be 'void*' instead of jintLong typed (really, function pointers should be stored as raw pointers, I would think... and at barrier points (and as I see, in the jni-call function I see return (jintLong) fnx_array[argCount][i] ... which raises warnings at build time.\r\n\r\nThe (void **) casts of the env variable is causing issues in hawtjni.c and hawtjni-callback.c because the compiler is being more type-strict.\r\n\r\n```\r\n.../jni/hawtjni.c: In function 'hawtjni_attach_thread':\r\n.../jni/hawtjni.c:54:12: warning: passing argument 2 of '(*JVM)->AttachCurrentThread' from incompatible pointer type\r\n     return (*JVM)->AttachCurrentThread(JVM, (void**)env, &args);\r\n            ^\r\n.../jni/hawtjni.c:54:12: note: expected 'const struct JNINativeInterface ***' but argument is of type 'void **'\r\n.../jni/hawtjni-callback.c: In function 'callback':\r\n.../jni/hawtjni-callback.c:710:7: warning: passing argument 2 of '(*jvm)->AttachCurrentThreadAsDaemon' from incompatible pointer type\r\n       (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void **)&env, NULL);\r\n       ^\r\n.../jni/hawtjni-callback.c:710:7: note: expected 'const struct JNINativeInterface ***' but argument is of type 'void **'\r\n.../jni/hawtjni-callback.c:716:5: warning: passing argument 2 of '(*jvm)->AttachCurrentThread' from incompatible pointer type\r\n     (*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL);\r\n     ^\r\n.../jni/hawtjni-callback.c:716:5: note: expected 'const struct JNINativeInterface ***' but argument is of type 'void **'\r\n```\r\nFix for those - drop the void** cast.\r\n\r\nSorry for the long-winded ticket, attempting to get lmdbjni building fully for Android w/ all platforms to test out some optimized handling and running into trouble."}}