Closed derezzedex closed 5 years ago
Look similar to #234. What NDK and SDK are you using?
That log is almost identical to mine in #234
08-31 18:23:06.465 1165 1208 I ActivityManager: Start proc 23557:rust.doze_widget/u0a266 for activity rust.doze_widget/android.app.NativeActivity
08-31 18:23:06.471 23557 23557 I ust.doze_widge: Late-enabling -Xcheck:jni
08-31 18:23:06.531 23557 23557 W System : ClassLoader referenced unknown path:
08-31 18:23:06.553 23557 23574 D libEGL : loaded /vendor/lib64/egl/libEGL_adreno.so
08-31 18:23:06.558 23557 23574 E libc : Access denied finding property "vendor.debug.egl.profiler"
08-31 18:23:06.557 23557 23557 W rust.doze_widget: type=1400 audit(0.0:30796): avc: denied { read } for comm=45474C20496E6974 name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=16625 scontext=u:r:untrusted_app:s0:c10,c257,c512,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
08-31 18:23:06.560 23557 23574 D libEGL : loaded /vendor/lib64/egl/libGLESv1_CM_adreno.so
08-31 18:23:06.573 23557 23574 D libEGL : loaded /vendor/lib64/egl/libGLESv2_adreno.so
08-31 18:23:06.582 23557 23557 D OpenGLRenderer: Skia GL Pipeline
08-31 18:23:06.601 23557 23557 W NativeActivity: ANativeActivity_onCreate not found: undefined symbol: ANativeActivity_onCreate
08-31 18:23:06.601 23557 23557 D AndroidRuntime: Shutting down VM
08-31 18:23:06.603 23557 23557 E AndroidRuntime: FATAL EXCEPTION: main
08-31 18:23:06.603 23557 23557 E AndroidRuntime: Process: rust.doze_widget, PID: 23557
08-31 18:23:06.603 23557 23557 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Unable to load native library "/data/app/rust.doze_widget-pGY_l-aNRaPr827BW82_MA==/lib/arm64/libdoze_widget.so": undefined symbol: ANativeActivity_onCreate
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.NativeActivity.onCreate(NativeActivity.java:175)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7144)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7135)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6718)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-31 18:23:06.603 23557 23557 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
08-31 18:23:06.607 1165 3529 W ActivityManager: Force finishing activity rust.doze_widget/android.app.NativeActivity
08-31 18:23:06.609 23557 23557 I Process : Sending signal. PID: 23557 SIG: 9
08-31 18:23:06.610 1165 1206 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
08-31 18:23:06.610 1165 1206 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
08-31 18:23:06.611 849 849 E lowmemorykiller: Error writing /proc/23557/oom_score_adj; errno=22
08-31 18:23:06.616 705 705 I Zygote : Process 23557 exited due to signal (9)
08-31 18:23:06.622 1165 9145 I ActivityManager: Process rust.doze_widget (pid 23557) has died: vis +99TOP
@philip-alldredge I don't know how I would check that, I'm using the latest from Android Studio.
It seems to be a known issue, look at #228:
Thanks to #232, I moved the
native_app_glue
into theandroid_glue
crate with a simplebuild.rs
that uses thecc
crate. However, I'm currently figuring out issues whtere thenative_app_glue
'sANativeActivity_onCreate
doesn't get included in the final library.
Maybe @mb64 could describe better what's happening.
@derezzedex that hasn't been merged yet so I didn't expect that to be a problem. You are using the master branch, correct? That does seem like the issue though @mb64
@derezzedex Please try a debug build and let me know if you have the same issue.
@philip-alldredge Tried, same error.
What version of rust are you using. I was able to reproduce the issue with 1.37.0.
@philip-alldredge Sorry for the late answer, but this is it:
rustc --version
rustc 1.37.0 (eae3437df 2019-08-13)
cargo --version
cargo 1.37.0 (9edd08916 2019-08-02)
sdkmanager --list
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;29.0.0 | 29.0.0 | Android SDK Build-Tools 29 | build-tools\29.0.0\
build-tools;29.0.2 | 29.0.2 | Android SDK Build-Tools 29.0.2 | build-tools\29.0.2\
cmake;3.10.2.4988404 | 3.10.2 | CMake 3.10.2.4988404 | cmake\3.10.2.4988404\
emulator | 29.0.11 | Android Emulator | emulator\
extras;intel;Hardware_Accelerated_Execution_Manager | 7.5.2 | Intel x86 Emulator Accelerator (HAXM installer) | extras\intel\Hardware_Accelerated_Execution_Manager\
lldb;3.1 | 3.1.4508709 | LLDB 3.1 | lldb\3.1\
ndk;20.0.5594570 | 20.0.5594570 | NDK (Side by side) 20.0.5594570 | ndk\20.0.5594570\
patcher;v4 | 1 | SDK Patch Applier v4 | patcher\v4\
platform-tools | 29.0.2 | Android SDK Platform-Tools | platform-tools\
platforms;android-29 | 3 | Android SDK Platform 29 | platforms\android-29\
system-images;android-28;google_apis_playstore;x86 | 8 | Google Play Intel x86 Atom System Image | system-images\android-28\google_apis_playstore\x86\
system-images;android-29;google_apis;x86 | 7 | Google APIs Intel x86 Atom System Image | system-images\android-29\google_apis\x86\
system-images;android-29;google_apis_playstore;x86 | 7 | Google Play Intel x86 Atom System Image | system-images\android-29\google_apis_playstore\x86\
tools | 26.1.1 | Android SDK Tools | tools\
I believe we've found the issue. It is an incompatibility with rust 1.37.0. I have opened a pull request that has a fix. I'm unsure if that is the final fix or if the maintainer will have a better solution. In the meantime, you can use the branch referenced in #237.
Thanks for reporting this. Otherwise, we may not have realized that there was an issue to be fixed and that it was widespread.
This is exactly the "linker issues" I was investigating in #228 ; I though it was caused by that PR, but apparently not!
So what's happening here is that rustc provides the linker with a "version script" (which is oddly named – it has nothing to do with versioning and everything to do with exporting symbols) that looks something like:
libwhatever {
global:
// All the extern "C" functions
android_main;
rust_eh_personality;
// If it's a cdylib, this is where it ends. If it's a dylib, it goes on to list all the mangled rust symbols:
_Z...
local:
*; // All the other symbols are local, and get stripped by --strip-all
}
The solution in #237 (rename the native_app_glue version and call it from an extern "C"
Rust wrapper) makes the most sense to me – there seems to be no way to change the impact of the version script by adding more linker args afterwards. Ideally we could have our own version script that only exports ANativeActivity_onCreate
, but there's no (good) way to do that.
Fixed by #237. However, this is a very testable problem, so I'd like to see CircleCI making sure the symbol exists. I'll work on that, and in the meantime keep this issue open.
After installing the master branch
cargo-apk
, and runningcargo-apk build --release
onexamples\basic
and succesfully installing the apk built withcargo-apk install
I got the following error while runningadb logcat
: