Mahammad Azimzada
Mahammad Azimzada

Reputation: 109

Flutter iOS 18.4 Debug Build Error: mprotect failed: 13 (Permission denied)

I am encountering an error when trying to run my Flutter application in debug mode on iOS 18.4. The build fails with the following message:

../../../flutter/third_party/dart/runtime/vm/virtual_memory_posix.cc: 428: error: mprotect failed: 13 (Permission denied)  
=== Crash occurred when compiling unknown function in unoptimized JIT mode in unknown pass  

Steps to Reproduce:

  1. Run the Flutter app in debug mode on an iOS device with version 18.4.

  2. Notice the error mentioned above.

3 . The build fails, and the app doesn’t launch.

Expected Results:

The Flutter app should run successfully in debug mode without any build errors.

Actual Results:

The build fails with a permission denied error related to mprotect.

Additional Information:

I found some information suggesting that iOS 18.4 has closed a loophole with get-task-allow, preventing apps from writing into their own executable memory. This change seems to affect Flutter’s development builds, possibly due to JIT compilation issues.

Question:

Has anyone else encountered this issue? Is there any workaround or solution to get the debug mode working on iOS 18.4? Any help would be greatly appreciated!

Upvotes: 3

Views: 116

Answers (1)

Sameri11
Sameri11

Reputation: 2780

Unfortunately, it's a recent regression connected with 18.4 iOS update. As you said in Additional info in your question, this happens because of closed loophole.

There are no workarounds in terms of some code patches exist now. And there's no solution to fix this behaviour on devices updated to 18.4. However, there are some options to mitigate the error:

  1. Use simulator instead of real device. This new behavior does not affects simulators because they use host kernel
  2. Use profile or release mode. It has obvious downside of lacking the hot-reload feature, yes, but these modes haven't been affected by 18.4 change
  3. Not in this case, obviously, but for future readers, do not update devices to iOS 18.4, if you want debug mode to work on it.

Also, I strongly suggest to follow the issue dedicated to this error because some new workaround may appear there.

Upvotes: 2

Related Questions