Failed to load dynamic library 'JavaScriptCore.framework/JavaScriptCore'
Versions: platform: macOS release (crash report collected from user), some devices.
Error:
Failed to load dynamic library 'JavaScriptCore.framework/JavaScriptCore': dlopen(JavaScriptCore.framework/JavaScriptCore, 1): no suitable image found. Did find:
file system relative paths not allowed in hardened programs
StackTrace:
Caused by
DynamicLibrary.open('JavaScriptCore.framework/JavaScriptCore')
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22)
#2 JscFfi.lib (package:flutter_js/javascriptcore/binding/jsc_ffi.dart:7)
#3 jSContextGroupCreate (package:flutter_js/javascriptcore/binding/js_context_ref.dart)
#4 new JavascriptCoreRuntime (package:flutter_js/javascriptcore/jscore_runtime.dart)
#5 getJavascriptRuntime (package:flutter_js/flutter_js.dart:45)
Others: According to this blog
The file path misses the / on the front and thus is a relative path. But that is forbidden for library loading for applications using hardened runtime, which is more strict for improved security.
i'm also getting this, any updates?
the same problem
I also encountered this problem. It seems that this library is no longer maintained? It's been over a year and still hasn't been closed.
Is there a solution ?
Fallback Flutter version to 3.19.3
The chaldea-center/flutter_js folk changed DynamicLibrary loading:
- ? DynamicLibrary.open('JavaScriptCore.framework/JavaScriptCore')
+ // or use:
+ // DynamicLibrary.open('/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore')
+ ? DynamicLibrary.process()
In iOS/macOS, DynamicLibrary.process() should include all global symbols which should contains JavaScriptCore, also you can specify the absolute path /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore.
Tested on macOS 14.2.1 and iOS 17.3.1, the above two open methods are both working.
If any other iOS/macOS/simulator version didn't support these two methods or have to specific absolute path, you can share your system version and solution here to help others.
https://github.com/flutter/flutter/issues/149407
I will change it and I will submit a patch version with the change
Fixed in flutter_js: ^0.8.1