Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haxe 4.3.0 and HXCPP 4.3.2 prodce APK that crashes on Android 10 #2631

Open
IriySoft opened this issue Apr 17, 2023 · 13 comments
Open

Haxe 4.3.0 and HXCPP 4.3.2 prodce APK that crashes on Android 10 #2631

IriySoft opened this issue Apr 17, 2023 · 13 comments

Comments

@IriySoft
Copy link

I’ve updated haxe to 4.3.0 and then OpenFL, Lime, HXCPP and other haxelibs to the latest versions.

Then compiled PiratePig example that is a part of OpenFL samples (GitHub - openfl/openfl-samples: Haxelib-based OpenFL sample projects).

The resulting build crashes on launch on Redmi 9C NFC (Android 10) with the following error:

image

The same build works fine on other devices that we have (Android 11+).

The Android build enviroment (NDK, Java and such) was the same as before the Haxe update and it worked well before.

Switching to older versions of OpenFL and Lime doesn't fix the issue. Switching to the previous hxcpp version is not possible with the new Haxe version installed.

The log is blow (filtered for the PID).

Also posted at openfl.org, sorry for the duplicate, just wanted to make sure this issue is noticed.

04-17 12:58:25.868   536   536 D Zygote  : Forked child process 5947
04-17 12:58:25.871  5947  5947 I Zygote  : DropCapabilitiesBoundingSet ro.build.version.type=
04-17 12:58:25.891  5947  5947 I mples.piratepi: Late-enabling -Xcheck:jni
04-17 12:58:25.895   535  1488 D OemNetd : setPidForPackage: packageName=org.openfl.samples.piratepig, pid=5947, pid=10493
04-17 12:58:25.896  1215  1245 I ActivityManager: Start proc 5947:org.openfl.samples.piratepig/u0a493 for activity {org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity} caller=com.miui.home
04-17 12:58:25.924  5947  5947 E mples.piratepi: Unknown bits set in runtime_flags: 0x8000
04-17 12:58:26.243  5005  5170 D PerfEngineController: ForegroundInfo{mForegroundPackageName='org.openfl.samples.piratepig', mForegroundUid=10493, mForegroundPid=5947, mLastForegroundPackageName='com.miui.home', mLastForegroundUid=10087, mLastForegroundPid=1690, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=1}
04-17 12:58:26.245  1215  2825 D PowerHalWrapper: amsBoostNotify pid:5947,activity:org.openfl.samples.piratepig.MainActivity, package:org.openfl.samples.piratepig, mProcessCreatePackorg.openfl.samples.piratepig 
04-17 12:58:26.247   566   593 I libPowerHal: [perfNotifyAppState] foreground:org.openfl.samples.piratepig, pid:5947, uid:10493
04-17 12:58:26.626  5947  5947 I FeatureParser: can't find angelican.xml in assets/device_features/,it may be in /vendor/etc/device_features
04-17 12:58:26.652  5947  5947 W mples.piratepig: type=1400 audit(0.0:12318): avc: denied { read } for name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=15589 scontext=u:r:untrusted_app_27:s0:c237,c257,c512,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
04-17 12:58:26.653  5947  5947 E libc    : Access denied finding property "ro.vendor.df.effect.conflict"
04-17 12:58:26.672  5947  6039 D libMEOW : applied 0 plugin for [org.openfl.samples.piratepig].
04-17 12:58:26.695  5947  5947 V SDL     : Device: angelican
04-17 12:58:26.695  5947  5947 V SDL     : Model: M2006C3MNG
04-17 12:58:26.696  5947  5947 V SDL     : onCreate()
04-17 12:58:26.707  5947  5947 W SDL     : Request to get environment variables before JNI is ready
04-17 12:58:26.720  5947  5947 W System.err: dlopen failed: cannot locate symbol "__atomic_compare_exchange_4" referenced by "/data/app/org.openfl.samples.piratepig-jmKUvKEuu0RJED5cXMMCqA==/lib/arm/libApplicationMain.so"...
04-17 12:58:26.850  5947  5947 I SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@f6e437d
04-17 12:58:26.907  5947  5947 I PowerHalWrapper: PowerHalWrapper.getInstance 
04-17 12:58:26.916  5947  5947 D ViewRootImpl[MainActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
04-17 12:58:26.925  5947  5947 D libMEOW : applied 0 plugin for [org.openfl.samples.piratepig].
04-17 12:58:26.927  5947  5947 I InputTransport: Create ARC handle: 0xe8beadf0
04-17 12:58:26.946  5947  5947 D ForceDarkHelper: updateByCheckExcludeList: pkg: org.openfl.samples.piratepig activity: org.openfl.samples.piratepig.MainActivity@8fa6dca
04-17 12:58:26.947  5947  5947 D ForceDarkHelper: updateByCheckExcludeList: pkg: org.openfl.samples.piratepig activity: org.openfl.samples.piratepig.MainActivity@8fa6dca
04-17 12:58:26.949  5947  5947 D ForceDarkHelper: updateByCheckExcludeList: pkg: org.openfl.samples.piratepig activity: org.openfl.samples.piratepig.MainActivity@8fa6dca
04-17 12:58:26.957  5947  5947 V SDL     : onStart()
04-17 12:58:26.961  5947  5947 V SDL     : onResume()
04-17 12:58:26.965  5947  5947 V PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView@4507b3b[]
04-17 12:58:26.967  5947  5947 I PowerHalWrapper: PowerHalWrapper.getInstance 
04-17 12:58:26.970  5947  5947 D ViewRootImpl[MainActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
04-17 12:58:26.980  5947  5947 I InputTransport: Create ARC handle: 0xe8beaf60
04-17 12:58:26.981  5947  5947 V PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@a399c96, this = DecorView@4507b3b[MainActivity]
04-17 12:58:26.985  5947  5947 W Looper  : Slow Looper SDLActivity: Activity org.openfl.samples.piratepig/.MainActivity is 400ms late (wall=0ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] }) because of 2 msg, msg 1 took 386ms (seq=2 running=354ms runnable=3ms io=5ms late=5ms h=android.app.ActivityThread$H w=110), msg 2 took 327ms (seq=3 running=245ms runnable=5ms io=39ms late=73ms h=android.app.ActivityThread$H w=159)
04-17 12:58:27.050  5947  6037 D libMEOW : applied 0 plugin for [org.openfl.samples.piratepig].
04-17 12:58:27.051  5947  6037 I GPUD    : @gpudInitialize: successfully initialized with GL, dbg=0 mmdump_dbg=0 mmpath_dbg=0
04-17 12:58:27.083  5947  6037 D Surface : Surface::connect(this=0xd55ca000,api=1)
04-17 12:58:27.084   620  1794 I BufferQueueProducer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#0](this:0xec1eb000,id:644,api:1,p:5947,c:620) connect(P): api=1 producer=(5947:org.openfl.samples.piratepig) producerControlledByApp=false
04-17 12:58:27.085  5947  6037 D Surface : Surface::setBufferCount(this=0xd55ca000,bufferCount=3)
04-17 12:58:27.086  5947  6037 D Surface : Surface::allocateBuffers(this=0xd55ca000)
04-17 12:58:27.103  5947  6037 W Gralloc3: mapper 3.x is not supported
04-17 12:58:27.106  5947  6037 E ion     : ioctl c0044901 failed with code -1: Invalid argument
04-17 12:58:27.166  5947  6037 D Surface : Surface::connect(this=0xd55ca800,api=1)
04-17 12:58:27.167   620  2270 I BufferQueueProducer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#1](this:0xe9496000,id:645,api:1,p:5947,c:620) connect(P): api=1 producer=(5947:org.openfl.samples.piratepig) producerControlledByApp=false
04-17 12:58:27.168  5947  6037 D Surface : Surface::setBufferCount(this=0xd55ca800,bufferCount=3)
04-17 12:58:27.168  5947  6037 D Surface : Surface::allocateBuffers(this=0xd55ca800)
04-17 12:58:27.246   620   646 I BufferQueueConsumer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#0](this:0xec1eb000,id:644,api:1,p:5947,c:620) setDefaultBufferSize: width=1044 height=664
04-17 12:58:27.256  5947  6037 D Surface : Surface::disconnect(this=0xd55ca000,api=1)
04-17 12:58:27.257   620   646 I BufferQueueProducer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#0](this:0xec1eb000,id:644,api:1,p:5947,c:620) disconnect(P): api 1
04-17 12:58:27.258  5947  6037 D Surface : Surface::connect(this=0xd55ca000,api=1)
04-17 12:58:27.259   620   646 I BufferQueueProducer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#0](this:0xec1eb000,id:644,api:1,p:5947,c:620) connect(P): api=1 producer=(5947:org.openfl.samples.piratepig) producerControlledByApp=false
04-17 12:58:27.260  5947  6037 D Surface : Surface::setBufferCount(this=0xd55ca000,bufferCount=3)
04-17 12:58:28.182   620  1339 I BufferQueueProducer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#0](this:0xec1eb000,id:644,api:1,p:5947,c:620) queueBuffer: fps=3.84 dur=1042.34 max=882.57 min=20.31
04-17 12:58:28.823  5947  6037 D Surface : Surface::disconnect(this=0xd55ca000,api=1)
04-17 12:58:28.824   620   646 I BufferQueueProducer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#0](this:0xec1eb000,id:644,api:1,p:5947,c:620) disconnect(P): api 1
04-17 12:58:28.825  5947  5947 D View    : [Warning] assignParent to null: this = DecorView@ca013e9[MainActivity]
04-17 12:58:28.825  5947  5947 I InputTransport: Destroy ARC handle: 0xe8beadf0
04-17 12:58:28.834  5947  5947 V SDL     : onPause()
04-17 12:58:28.996  5005  5034 D PerfEngineController: ForegroundInfo{mForegroundPackageName='com.miui.home', mForegroundUid=10087, mForegroundPid=1690, mLastForegroundPackageName='org.openfl.samples.piratepig', mLastForegroundUid=10493, mLastForegroundPid=5947, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0}
04-17 12:58:29.030  5947  5947 V SDL     : onStop()
04-17 12:58:29.032  5947  5947 V PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@a399c96, this = DecorView@4507b3b[MainActivity]
04-17 12:58:29.042  5947  5947 V SDL     : onDestroy()
04-17 12:58:29.045  5947  6037 D Surface : Surface::disconnect(this=0xd55ca800,api=1)
04-17 12:58:29.047   620   646 I BufferQueueProducer: [org.openfl.samples.piratepig/org.openfl.samples.piratepig.MainActivity#1](this:0xe9496000,id:645,api:1,p:5947,c:620) disconnect(P): api 1
04-17 12:58:29.049  5947  5947 D View    : [Warning] assignParent to null: this = DecorView@4507b3b[MainActivity]
04-17 12:58:29.049  5947  5947 I InputTransport: Destroy ARC handle: 0xe8beaf60
04-17 12:58:29.057  5947  6037 I GED     : ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 2, oppidx_max 2, oppidx_min 0
@joshtynjala
Copy link
Member

Which NDK version are you using?

@IriySoft
Copy link
Author

IriySoft commented Apr 18, 2023

Which NDK version are you using?

Tried with two build configurations:

Config 1
NDK 21.4.7075529
java 17.0.4.1 2022-08-18 LTS

(I put NDK 24.0.8215888 originally here, but it was a mistake)

Config 2
android-ndk-r21e
openjdk 11.0.18 2023-01-17

Both configs
haxelib: [4.0.3]
hxcpp: [4.3.2]
lime: [8.0.1]
openfl: [9.2.1]
haxe: 4.3.0
android target-sdk-version="31"
android minimum-sdk-version="21"
android gradle-version="7.3.3"
android gradle-plugin="7.2.2"

@IriySoft
Copy link
Author

IriySoft commented Apr 18, 2023

Quick update, maybe this helps to nail the issue. When launching with MEmu (that has Android 7.1) I've got a different error (see the screenshot below). Same emulator runs the same app built with previous version of Haxe+HXCPP perfectly fine.

image

@joshtynjala
Copy link
Member

NDK r21e is the newest known NDK to work with Lime/hxcpp right now, and 24 is definitely expected to fail. We intend to support newer NDKs in the future, though. Before r21e, r15c was usually our recommendation, so that might be worth trying too.

It's certainly possible that something needs to be fixed in Lime to properly support Haxe/hxcpp 4.3, though. Personally, I haven't had a chance to fully test things out.

@IriySoft
Copy link
Author

NDK r21e is the newest known NDK to work with Lime/hxcpp right now, and 24 is definitely expected to fail. We intend to support newer NDKs in the future, though. Before r21e, r15c was usually our recommendation, so that might be worth trying too.

Oh actually it was a mistake. I do have NDK 24 installed, but NDK 21 is used for Android build. Sorry for the mess, the NDK in config 1 is 21.4.7075529. Will edit the original post too.

It's certainly possible that something needs to be fixed in Lime to properly support Haxe/hxcpp 4.3, though. Personally, I haven't had a chance to fully test things out.

Thanks, it's actually easy to test since the issue can be reproduced with an emulator, hope it can be addressed. On our end we just don't have enough understanding to try to fix it :)

@rainyt
Copy link
Contributor

rainyt commented May 17, 2023

Use r15c is ok?

@rainyt
Copy link
Contributor

rainyt commented May 19, 2023

Tested, use r15c NDK is ok.

@IriySoft
Copy link
Author

Tested, use r15c NDK is ok.

Does "OK" mean that the APK doesn't crash, or that it compiles? :)
Anyway, r15c is outdated and it's not a good solution even if it works.

@rainyt
Copy link
Contributor

rainyt commented May 19, 2023

Yes, it can compile normally and this error will not occur: __atomic_compare_exchange_4, agree that it's too old! :)

@joshtynjala
Copy link
Member

We actually build lime.ndll with NDK r15c because this is the only known NDK that works for it. For a long time, r15c was also the only known good NDK for building apps too. My discovery that r21e worked for apps is relatively recent. It's unfortunate that it doesn't seem to work with Haxe 4.3.

In Lime 8.2.0, the a number of dependencies and things have been updated, and we found that we could build lime.ndll with r21e. Presumably, when using Lime 8.2.0, you will be able to build an app with r21e too. You could try a nightly build of Lime from the 8.2.0-Dev branch, if you want to test things out.

Lime 8.2+ should be able to start using newer NDKs than r21e after the next hxcpp update because HaxeFoundation/hxcpp#992 was merged recently (but it hasn't been released to Haxelib yet).

@IriySoft
Copy link
Author

Thanks! :)

@pozirk
Copy link
Member

pozirk commented Jun 26, 2023

Was the issue actually fixed?
I'm thinking to move to the latest OpenFL/Lime. :)

@joshtynjala
Copy link
Member

@pozirk As I recall, you won't get the __atomic error as long as you use NDK r15c.

For those who don't mind living on the edge, using the 8.2.0-Dev branch of Lime and the latest master branch of hxcpp allows you to bypass NDKs that cause the __atomic error and use the latest NDK r25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants