Open kechankrisna opened 1 year ago
@kechankrisna I think they're working on it via this PR: https://github.com/openwebf/webf/pull/162 I wonder if @andycall can create any issue that let us follow up with this. Glad to help :D
The CI breaks out now, it shouldn't take much times to fixed it. I can release a beta version supporting windows this week.
@NoahJinnn @kechankrisna I finally figure out how to build webf dll in github actions. The first initialize version for windows is 0.14.0-beta.11+2.
I'm facing this issue while running webf/example
on my Windows 11 laptop.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'webf.dll': error code 126
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
#2 WebFDynamicLibrary.ref (package:webf/src/bridge/dynamic_library.dart:56:52)
#3 _registerPluginByteCode (package:webf/src/bridge/to_native.dart:256:24)
#4 _registerPluginByteCode (package:webf/src/bridge/to_native.dart)
#5 registerPluginByteCode (package:webf/src/bridge/to_native.dart:261:3)
#6 registerWebfWebsocketByteData (package:webf_websocket/websocket_qjsc.dart:12:3)
#7 WebFWebSocket.initialize (package:webf_websocket/webf_websocket.dart:8:5)
#8 main (package:webf_example/main.dart:12:17)
#9 _runMain.<anonymous closure> (dart:ui/hooks.dart:131:23)
#10 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#11 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
Re-produce steps:
webf
on branch beta/0.14.0
to use it directly:
git clone git@github.com:openwebf/webf.git
git checkout beta/0.14.0
npm install
npm run build:bridge:windows
cd webf/example
flutter run
example/pubspec.yaml
as below:
webf: ^0.14.0-beta.11+2
# dependency_overrides:
# webf:
# path: ../
Then, run flutter clean
and flutter run
again.
The same error returned for both cases. Do you have any suggestion? @andycall
It seems like the webf.dll can not loaded from flutter apps. But I tested works on my Windows 10. Please check the these dll files are exist on build/windows/runner/Debug directory.
i got a Debug Assertion Failed error
@swqsldz can you provide your test codes so I can reproduce on my devices?
url: https://pan.baidu.com/s/1O_EdOzfgUdvlpGY2R69-rw?pwd=7tlr pwd:7tlr flutter version: 3.7.3
@swqsldz Hmm, I can't access the Baidu Disk address on my laptop. Could you create a GitHub repository and upload your code there instead?
just use the flutter create demo
import 'package:flutter/material.dart';
import 'package:webf/webf.dart';
import 'package:webf_websocket/webf_websocket.dart';
void main() {
WebFWebSocket.initialize();
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: WebF(
bundle: WebFBundle.fromUrl('https://www.baidu.com/'),
)),
);
}
}
webf: ^0.14.0-beta.11+2 webf_websocket: ^1.2.0
@swqsldz try 0.14.0-beta.11+3
@NoahJinnn Here is a released Windows binary build with WebF 0.14.0-beta.11+3. It has been tested on several Windows machines. You can try it to see if there are any other configurations that could affect the running of WebF.
@andycall I'm able to run flutter create project with webf
, my pubspec.yaml
:
However, I still get the error logs as below:
Result:
If these files are exist on your project's build directory? , the path is : <your_app>/build/windows/runner/Debug
@NoahJinnn
Yes I have those files inside /build/windows/runner/Debug
@andycall
I'm also trying with webf
example, the html
asset file was not shown. Able to run the app itself (even with .exe
or flutter run
), but the webf
instance was not loaded.:
Output:
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.11, on Microsoft Windows [Version 10.0.22621.1194], locale en-US)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.4)
[!] Android Studio (not installed)
[✓] VS Code (version 1.77.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
The webf.dll
can not loaded in your windows machines, I have no idea what happened.
But you can try some ways to diagnose the problems.
The error shows testapp.exe
cannot locate the webf.dll
files, but you can try set the absolute path to the webf.dll
to see if it works.
static DynamicLibrary? _ref;
static DynamicLibrary get ref {
DynamicLibrary? nativeDynamicLibrary = _ref;
_ref = nativeDynamicLibrary ??= DynamicLibrary.open('D:\the_absolute_path\to\webf.dll');
return nativeDynamicLibrary;
}
@andycall I can not build windows
binary for webf
using the branch you mentioned. Faced this issues while I was running npm run build:bridge:windows
:
CMake Error at CMakeLists.txt:204 (add_subdirectory):
The source directory
C:/Users/Noah/Desktop/webf/bridge/third_party/quickjs/vendor/mimalloc
does not contain a CMakeLists.txt file.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Noah/Desktop/webf/bridge/cmake-build-windows/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Noah/Desktop/webf/bridge/cmake-build-windows/CMakeFiles/CMakeError.log".
C:\Users\Noah\Desktop\webf\node_modules\async-done\index.js:18
throw err;
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
uid: 3,
name: 'build-window-webf-lib',
branch: false,
error: Error: Command failed: cmake --log-level=VERBOSE -DCMAKE_BUILD_TYPE=Debug -DVERBOSE_CONFIGURE=ON -B C:\Users\Noah\Desktop\webf\bridge\cmake-build-windows -S C:\Users\Noah\Desktop\webf\bridge
at checkExecSyncError (node:child_process:885:11)
at execSync (node:child_process:957:15)
at C:\Users\Noah\Desktop\webf\scripts\tasks.js:599:3
at taskWrapper (C:\Users\Noah\Desktop\webf\node_modules\undertaker\lib\set-task.js:13:15)
at bound (node:domain:433:15)
at runBound (node:domain:444:12)
at asyncRunner (C:\Users\Noah\Desktop\webf\node_modules\async-done\index.js:55:18)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 16772,
stdout: null,
stderr: null,
domainThrown: true
},
duration: [ 8, 539767800 ],
time: 1683886679791
})
at new NodeError (node:internal/errors:399:5)
at Gulp.emit (node:events:502:17)
at Gulp.emit (node:domain:489:12)
at Object.error (C:\Users\Noah\Desktop\webf\node_modules\undertaker\lib\helpers\createExtensions.js:61:10)
at handler (C:\Users\Noah\Desktop\webf\node_modules\now-and-later\lib\mapSeries.js:47:14)
at f (C:\Users\Noah\Desktop\webf\node_modules\once\once.js:25:25)
at f (C:\Users\Noah\Desktop\webf\node_modules\once\once.js:25:25)
at tryCatch (C:\Users\Noah\Desktop\webf\node_modules\async-done\index.js:24:15)
at done (C:\Users\Noah\Desktop\webf\node_modules\async-done\index.js:40:12)
at Domain.onError (C:\Users\Noah\Desktop\webf\node_modules\async-done\index.js:51:5) {
code: 'ERR_UNHANDLED_ERROR',
context: {
uid: 3,
name: 'build-window-webf-lib',
branch: false,
error: Error: Command failed: cmake --log-level=VERBOSE -DCMAKE_BUILD_TYPE=Debug -DVERBOSE_CONFIGURE=ON -B C:\Users\Noah\Desktop\webf\bridge\cmake-build-windows -S C:\Users\Noah\Desktop\webf\bridge
at checkExecSyncError (node:child_process:885:11)
at execSync (node:child_process:957:15)
at C:\Users\Noah\Desktop\webf\scripts\tasks.js:599:3
at taskWrapper (C:\Users\Noah\Desktop\webf\node_modules\undertaker\lib\set-task.js:13:15)
at bound (node:domain:433:15)
at runBound (node:domain:444:12)
at asyncRunner (C:\Users\Noah\Desktop\webf\node_modules\async-done\index.js:55:18)
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 16772,
stdout: null,
stderr: null,
domainThrown: true
},
duration: [ 8, 539767800 ],
time: 1683886679791
}
}
run git submodule update --init --recursive
can retry
The
webf.dll
can not loaded in your windows machines, I have no idea what happened.But you can try some ways to diagnose the problems.
The error shows
testapp.exe
cannot locate thewebf.dll
files, but you can try set the absolute path to thewebf.dll
to see if it works.static DynamicLibrary? _ref; static DynamicLibrary get ref { DynamicLibrary? nativeDynamicLibrary = _ref; _ref = nativeDynamicLibrary ??= DynamicLibrary.open('D:\the_absolute_path\to\webf.dll'); return nativeDynamicLibrary; }
Did use absolute path but still faced the same error of loading dynamic library:
is your laptop are running in 32 bit mode?
wmic cpu get AddressWidth
wmic cpu get AddressWidth
Its x64
PS C:\Users\Noah\Desktop\webf> wmic cpu get AddressWidth
AddressWidth
64
@andycall Is the Windows SDK causing issues? I did check googletest
README (webf\bridge\third_party\googletest\README.md) and find out its required low version of MSVC:
### Operating Systems
* Linux
* macOS
* Windows
### Compilers
* gcc 5.0+
* clang 5.0+
* MSVC 2015+
My current Windows tools installation with Visual Studio:
Error code 193 is due to using a 64 bit sdk and loading a 32 bit dll, or vice versa.
But I checked all dlls hosted on pub.dev are all 64-bit formats.
Maybe you can try the following module on your laptop to see if it works? It has the same loading phases as WebF on Windows.
Error code 193 is due to using a 64 bit sdk and loading a 32 bit dll, or vice versa.
But I checked all dlls hosted on pub.dev are all 64-bit formats.
I did check the dynamic built from webf
, they're all 64-bit:
I had all the built files inside <your_app>/build/windows/runner/Debug+Release
:
Able to run on my mac M1 but still fail on my Windows 11... Facing different error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'webf.dll': error code 126
Regarding the 126 error
code, guess that I'm missing some module to load those dynamic libs
My test repo: https://github.com/NoahJinnn/test-webf
@andycall can you help me to check the repo?
My logs when run npm run build:bridge:windows
:
28 Warning(s)
0 Error(s)
Looks like the build is success
It just works on my windows 11, but I still don't know something was wrong in your laptop.
It just works on my windows 11, but I still don't know something was wrong in your laptop.
Can you show me your laptop's VS Desktop development toolchains?
I'm using 2022 VS Desktop development with C++ toolchain:
My Windows version:
My VS 2022 installation:
I don't think these installation can affect the loadin process of webf.dll
. My recommendation is to try another flutter package that relies on Dart FFI to work, for example: https://pub.dev/packages/flutter_qjs
If flutter_qjs
works well on your laptop and webf does not, there might be some configure error in WebF,
However, if flutter_qjs
also fails to works, It could due to some bugs in Dart FFI causing dynamic library loading problems. In this case, we can fire a issue to https://github.com/dart-lang/sdk
Thanks for your information. I did try flutter_qjs
and also run failed, maybe the issue is due to dart sdk. Thank you so much!
@NoahJinnn Here is a minimal example with Dart FFI: https://github.com/dart-lang/samples/tree/main/ffi/hello_world
Run the following commands to build the hello.dll
cd .\hello_library\
cmake .
cmake --build .
Then run the following commands to test this example:
dart pub get
dart hello.dart
If you got the "hello world" result, It proves that the main loading DLL process through Dart FFI works. Therefore, I suspect that the problems might be due to some cirtical DLL files missing in your system.
If you can not run this minimal example, the only way would be ask the dart team what's going on.
@NoahJinnn Here is a minimal example with Dart FFI: https://github.com/dart-lang/samples/tree/main/ffi/hello_world
Run the following commands to build the
hello.dll
cd .\hello_library\ cmake . cmake --build .
Then run the following commands to test this example:
dart pub get dart hello.dart
If you got the "hello world" result, It proves that the main loading DLL process through Dart FFI works. Therefore, I suspect that the problems might be due to some cirtical DLL files missing in your system.
If you can not run this minimal example, the only way would be ask the dart team what's going on.
I'm able to run the example with the successful result:
C:\Users\Noah\Desktop\samples\ffi\hello_world> dart hello.dart
Hello World
So, I think my laptop is missing some critical .dll
library
@andycall I use "Process Monitoring" to trace the dll
loading process and realize that there're many processes not in SUCCESS result.
webf.dll
processes:
webf_plugin.dll
processes:
@NoahJinnn I'm on a business trip and only have a macbook with me. I'll need to return home and use my Windows PC to investgate this problem over the weekend.
Should this be an RFC?
Description
Is there any initialize version for windows? so community can help to contribute the rest part.
Alternatives and Workarounds
No response