Android builds that uses Haxe 4.3+ and HXCPP 4.3+ crash on some devices

I’ve been using Haxe 4.3 for a while now, and I’m not aware of any issues with Lime. Can you let us know what isn’t working for you? Thanks!

Android builds that uses Haxe 4+ and HXCPP 4+ crash on some devices:

@IriySoft

I was able to reproduce this error message with an OpenFL app on one of my Android devices.

Copying the error message below for more context in searches:

SDL Error
An error occurred while trying to start the application. Please try again and/or reinstall.
Error: dlopen failed: cannot locate symbol “__atomic_compare_exchange_4” referenced by “/data/app/org.openfl.samples.piratepig-BgzsbLgcUjNKy7Hr5k-Fvg==/lib/arm/libApplicationMain.so” …

I tried to set up my environment as closely as I could to what you reported.

  • Haxe 4.3.4
  • NDK 21.4.7075529
  • Java: OpenJDK 11
  • hxcpp 4.3.2
  • Lime 8.1.2
  • OpenFL 9.3.3

I was able to successfully resolve this issue on my Andorid device by installing the latest hxcpp from GitHub instead of using hxcpp 4.3.2.

As a bonus, this also made it possible for me to use a newer NDK than I ever had in the past. Previously, I was not able to use anything newer than NDK 21.4.7075529. With the latest hxcpp, I was able to successfully build with NDK 25.2.9519653.

2 Likes

For reference, I installed the latest Git commit of hxcpp with the following command:

haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp.git

Thanks for checking! Will try to migrate to the Git version of HXCPP :+1:

It’s cool that higher versions of NDK can be used too!

1 Like

Worked for me! Thanks. Tried with NDK21, will check with NDK25 later.

1 Like

NDK 25.2.9519653 works too! :handshake:

1 Like

Resurrecting!
I’m trying to bulid my game in the following environment:

  • Haxe 4.3.6
  • NDK 21e
  • Java: OpenJDK 17
  • hxcpp 4.3.2
  • Lime 8.2.2
  • OpenFL 9.4.1

It crashes with SDL Error “__atomic_compare_exchange_4”.
So, I download the latest hxcpp from github, my game starts successfully, but with the artifacts all over the screen:

And now if I move the game to the background, it crashes.

Are there any way to just fix this SDL Error manually in hxcpp 4.3.2 without downloading it from github?
What is exactly broken over there?

Crash problem when moving app to the background is this:

java.lang.SecurityException: cancelVibrate: Neither user 10424 nor current process has android.permission.VIBRATE.

Any connections with this update:

  • Fixed missing cancellation of vibration on Android when app is paused or destroyed.

From OpenFL 9.3.4 and Lime 8.1.3 Release

UPDATE:
Probably these are not github hxcpp version problems after all. :smiley:

Does this JPG rendering issue happen only on Android? Do you see the same thing on any desktop native C++ targets (windows/mac/linux)?

I have committed the following fix for the JPG issue (which affected 32-bit platforms only): libjpeg: fix rendering on 32-bit platforms · openfl/lime@44dd331 · GitHub

I have committed the following fix for the Android vibration issue by checking if the permission is set before trying to call the API: GameActivity: check for VIBRATE permission on Android · openfl/lime@951d551 · GitHub

1 Like