Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25948] [Android] Hyperloop 3.0.4 throws an error when building for Android

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-04-12T08:44:32.000+0000
Affected Version/sRelease 7.1.1
Fix Version/sRelease 7.1.1
ComponentsAndroid
Labelsn/a
ReporterSamir Mohammed
AssigneeEwan Harris
Created2018-04-09T21:30:47.000+0000
Updated2018-04-12T23:55:44.000+0000

Description

When trying to run the hyperloop examples app on an android emulator on a Windows computer( Issue can also be seen on devices for some people). The application will crash and show the following error:
[DEBUG] : AndroidRuntime: Shutting down VM
 	[ERROR] : TiApplication: (main) [14,547] Sending event: exception on thread: main msg:java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt3__112__next_primeEj" referenced by "/data/app/com.appc.a11-2/lib/x86/libhyperloop.so"...; Titanium 7.1.1,2018/04/04 11:05,undefined
 	[ERROR] : TiApplication: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt3__112__next_primeEj" referenced by "/data/app/com.appc.a11-2/lib/x86/libhyperloop.so"...
 	[ERROR] : TiApplication: at java.lang.Runtime.loadLibrary0(Runtime.java:989)
 	[ERROR] : TiApplication: at java.lang.System.loadLibrary(System.java:1530)
 	[ERROR] : TiApplication: at org.appcelerator.kroll.runtime.v8.V8Runtime.loadExternalModules(V8Runtime.java:142)
 	[ERROR] : TiApplication: at org.appcelerator.kroll.runtime.v8.V8Runtime.initRuntime(V8Runtime.java:109)
 	[ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime.doInit(KrollRuntime.java:207)
 	[ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:113)
 	[ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime.init(KrollRuntime.java:135)
 	[ERROR] : TiApplication: at com.appc.a11.A11Application.onCreate(A11Application.java:93)
 	[ERROR] : TiApplication: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
 	[ERROR] : TiApplication: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
 	[ERROR] : TiApplication: at android.app.ActivityThread.-wrap2(ActivityThread.java)
 	[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
 	[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102)
 	[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:154)
 	[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:6119)
 	[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method)
 	[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
 	[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
*Test Steps* + Download and import the Hyperloop examples application [Hyperloop examples App](https://github.com/appcelerator/hyperloop-examples) + Download and add Hyperloop 3.0.4 in to the imported project. [Hyperloop 3.0.4](https://github.com/appcelerator/hyperloop.next/releases/tag/v3.0.4) + Run the application *Expected result* Application should not crash and run without issues. *Actual result* Application shows the above error.

Comments

  1. Ewan Harris 2018-04-10

    Adding some more info as I was able to repro this - For me, it happens on OSX and Windows on device and emulators. - Walking through the master builds produced by jenkins, everything up to https://github.com/appcelerator/hyperloop.next/pull/278 works - But, building hyperloop locally with the SDK that is selected as the default in that PR works for me - https://github.com/appcelerator/hyperloop.next/pull/287 works for me, which appears to indicate that between 7.0.0 and 7.1.1 _something_ has broken. I don't think we should merge that PR
  2. Ewan Harris 2018-04-11

    Decided to take a walk through build histories to track this down in https://github.com/appcelerator/hyperloop.next/pull/288 Here's what I found, * Builds of hyperloop built on Jenkins are broken since 7.0.0.v20171113133758 * Git hash for that build, refers to this PR https://github.com/appcelerator/titanium_mobile/pull/9265 * I've tried the following Android versions with that module ** Devices *** Note 3 on lineage OS 14.1 (Android 7.1.2), crashes (x) *** Oneplus 3 on their stock (Android 7.1.1), crashes (x) *** Samsung Galaxy S8 (Android 8.0.0), no crash (/) ** Emulators *** Android Nexus 6 Emulator with 8.1, no crash (/) *** Android Nexus 5X Emulator with 7.1.1, crash (x) *** Android Nexus 5X Emulator with 6.0, no crash (/) So there seems to almost definitely a pattern here (unless I'm crazy, which is possible). I don't understand that change enough to know what the potential variables at play here are. My thoughts are maybe NDK version? For the life of me I can't figure out what version of the NDK Jenkins uses, anyone any clues? cc [~gmathews] [~jquick] [~amukherjee]
  3. Ewan Harris 2018-04-11

    Step cat $ANDROID_NDK/RELEASE.txt on https://jenkins.appcelerator.org/blue/organizations/jenkins/titanium-sdk%2Fhyperloop.next/detail/PR-288/14/pipeline/30 (release.txt was removed in NDK 11....) shows this is r10e (64-bit) being used, downloading and building hyperloop locally to test the theory
  4. Ewan Harris 2018-04-11

    Confirmed building locally with ndk r10e causes a bad build. Filed some tickets TIMOB-25959 to fail the build on invalid NDK, TIMOB-25958 to log the NDK used. So here's the lay of the land * The root cause for this failure is because Jenkins is building modules with NDK r10e * NDK r10e has been marked as unsupported in our package.json since https://github.com/appcelerator/titanium_mobile/pull/9274, I have no idea what the docs say Here's what I think we should do * Fix the tickets I filed if possible * Update Jenkins to a newer NDK * Cut a hyperloop 3.0.5 with either https://github.com/appcelerator/hyperloop.next/pull/287 merged, or the above fixed (because of this I'm escalating this ticket to a blocker for SDK 7.1.1 release) It seems like this is possible causing bugs for others, I saw someone else run into a similar error on tislack https://ti-slack.slack.com/archives/C03CVQX2A/p1523439818000326
  5. Joshua Quick 2018-04-11

    [~eharris], I'm thinking the devices the app crashed on are 64-bit and the hyperloop build system using the older NDK failed to produce an ARM64 "libhyperloop.so" library file, but likely produced an *.so library for the ARMv7 and x86 architectures. Since Titanium 7.0.0, we now produce ARM64 binaries for the core. Since the an ARM64 Android OS sees that the APK has an ARM64 binary directory, it'll only load C/C++ libraries from that directory. I recommend that you confirm this for yourself by doing the following:

    Building the Android APK with the old NDK installed.

    Go to the built APK directory in Finder: ./build/android/bin/

    Renamed APK file extension from *.apk to *.zip.

    Unzip the APK.

    Go to the unzipped APK's "lib/arm64-v8a" directory.

    Verify that a "libhyperloop.so" file exists. _(If not, then there's the problem.)_

    Go to the APK's "lib/armeabi-v7a" directory.

    Verify that a "libhyperloop.so" file exists. _(I suspect it does.)_

  6. Ewan Harris 2018-04-11

    [~jquick] I'll take a look tomorrow, but I think the Note 3 isn't 64 bit
  7. Ewan Harris 2018-04-11

    [~jquick] Got curious and took a look Using the below, I see libhyperloop.so in arm64-v8a, armeabi-v7a, and x86 directories when checking the apk * Oneplus 3 * Hyperloop 3.0.4 * SDK 7.1.1.v20180406141533 * Android NDK set to r10e * Android SDK 25 I've put up a PR to use NDK 12 on Jenkins: (https://github.com/appcelerator/hyperloop.next/pull/289) and verified that the built module works for me on my Oneplus
  8. Gary Mathews 2018-04-11

    Confirmed https://github.com/appcelerator/hyperloop.next/pull/290 fixes this issue: - 3.0.4 crashes on my Pixel device running Android 7.1.1 - 3.0.5 works on my Pixel device running Android 7.1.1 *titanium_mobile* master: https://github.com/appcelerator/titanium_mobile/pull/9997 7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9998
  9. Joshua Quick 2018-04-11

    Okay. Then it's like you said. The older NDK r10e is not "ABI" compatible with the newest NDK versions. We should refuse to compile with any NDK version that's outside of our supported NDK version range. We can only support versions that have been proven to be ABI compatible with each other. For your info, this is the downside of publicly exporting C++ APIs. There's no standard when it comes to C++ name mangling rules and it often differs between C/C++ compiler vendors and between versions from the same vendor. You typically avoid this issue by ensuring all C++ libraries are compiled with the same compiler and version... or avoid the issue entirely and only export C APIs from C++. Case-in-point, Microsoft has recently documented that their VisualC++ compiler included with Visual Studio 2017 is (mostly) ABI compatible with 2015. Not Android related, but my point is C++ ABI compatibility is something to be concerned about on all platforms. https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017
  10. Samir Mohammed 2018-04-12

    FRs passed once CRs have been passed the following can be merged: master: https://github.com/appcelerator/titanium_mobile/pull/9997 7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9998 Hyperloop: https://github.com/appcelerator/hyperloop.next/pull/290
  11. Lokesh Choudhary 2018-04-12

    Verified hyperloop 3.0.5 (in 7.1.1.v20180412101616) does not throw error on android 7.1.1. [~smohammed], Can you please confirm on windows with the latest SDK & close the ticket.
  12. Samir Mohammed 2018-04-12

    Verified hyperloop fix 3.0.5 in SDK version 7.1.1.v20180412101616 and SDK 7.2.0.v20180412111125. Test and other information can be found at: master: https://github.com/appcelerator/titanium_mobile/pull/9997 7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9998 Hyperloop: https://github.com/appcelerator/hyperloop.next/pull/290

JSON Source