flutter_js icon indicating copy to clipboard operation
flutter_js copied to clipboard

Failed to load dynamic library 'JavaScriptCore.framework/JavaScriptCore'

Open narumi147 opened this issue 2 years ago • 1 comments

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.

narumi147 avatar May 14 '23 18:05 narumi147

i'm also getting this, any updates?

hpelitebook745G2 avatar Jan 26 '24 07:01 hpelitebook745G2

the same problem

guuguo avatar May 21 '24 12:05 guuguo

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.

DeanFs avatar May 22 '24 06:05 DeanFs

Is there a solution ?

RonanCN avatar May 24 '24 02:05 RonanCN

Fallback Flutter version to 3.19.3

pozi119 avatar May 24 '24 07:05 pozi119

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.

narumi147 avatar May 25 '24 08:05 narumi147

https://github.com/flutter/flutter/issues/149407

I will change it and I will submit a patch version with the change

abner avatar Jun 07 '24 06:06 abner

Fixed in flutter_js: ^0.8.1

abner avatar Jun 08 '24 16:06 abner