Open christopherfujino opened 5 months ago
I attempted to link a release build of a Flutter C++ entrypoint to a debug engine, but got the following linker errors:
[ ] "D:\git\tmp\delete_me_flutter\build\windows\x64\INSTALL.vcxproj" (default target) (1) ->
[ ] "D:\git\tmp\delete_me_flutter\build\windows\x64\ALL_BUILD.vcxproj" (default target) (3) ->
[ ] "D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj" (default target) (4) ->
[ ] (Link target) ->
[ ] flutter_wrapper_app.lib(core_implementations.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] flutter_window.obj : error LNK2001: unresolved external symbol __imp__invalid_parameter [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] main.obj : error LNK2001: unresolved external symbol __imp__invalid_parameter [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] utils.obj : error LNK2001: unresolved external symbol __imp__invalid_parameter [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] flutter_wrapper_app.lib(flutter_engine.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] flutter_wrapper_app.lib(core_implementations.obj) : error LNK2001: unresolved external symbol __imp__CrtDbgReport [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] flutter_window.obj : error LNK2001: unresolved external symbol __imp__CrtDbgReport [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] main.obj : error LNK2001: unresolved external symbol __imp__CrtDbgReport [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] utils.obj : error LNK2001: unresolved external symbol __imp__CrtDbgReport [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] flutter_wrapper_app.lib(flutter_engine.obj) : error LNK2001: unresolved external symbol __imp__CrtDbgReport [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] D:\git\tmp\delete_me_flutter\build\windows\x64\runner\Debug\delete_me_flutter.exe : fatal error LNK1120: 2 unresolved externals [D:\git\tmp\delete_me_flutter\build\windows\x64\runner\delete_me_flutter.vcxproj]
[ ] 0 Warning(s)
[ ] 11 Error(s)
Loic got similar errors with https://github.com/loic-sharma/flutter_raw_cpp, which is a pure C++/Visual Studio project that links to the debug flutter engine (link). This project succeeds in debug mode, but fails to link in release mode.
From a brief look:
The Dart dependencies on windows are listed here, they are due to process wide memory allocators, sockets, etc.
Flutter seems to have a copy_dlls step in the build root that copies various dlls (see here - which includes those non-dist dlls). This code in the buildroot is very old and therfore unclear for what it's needed (if it's still needed).
I don't know what "flutter preview device" is how how it's built, but it may be that it's build is linked against all those dlls that are copied by the build root scripts.
I don't know what "flutter preview device" is how how it's built, but it may be that it's build is linked against all those dlls that are copied by the build root scripts.
Right, this is not (directly) related to the engine or Dart VM, but the way we build the preview device's main.cc entrypoint. The Preview Device is essentially a debug build of the Flutter counter app for Windows, so we use the open source toolchain (CMake, MSBuild, VS compiler).
This issue is marked P1 but has had no recent status updates.
The P1 label indicates high-priority issues that are at the top of the work list. This is the highest priority level a bug can have if it isn't affecting a top-tier customer or breaking the build. Bugs marked P1 are generally actively being worked on unless the assignee is dealing with a P0 bug (or another P1 bug). Issues at this level should be resolved in a matter of months and should have monthly updates on GitHub.
Please consider where this bug really falls in our current priorities, and label it or assign it accordingly. This allows people to have a clearer picture of what work is actually planned. Thanks!
When running the
dumpbin.exe
tool on a compiled flutter_preview.exe to determine dynamically linked dependencies:Of these, the following are commonly available on new Windows installation:
flutter_windows.dll is explicitly provided by the flutter tool. The following are not part of a new Windows installation, however, and are C/C++ debug libraries:
The first three of these are distributed with Visual Studio, in a directory marked "debug_nondredist" (see https://learn.microsoft.com/en-us/visualstudio/releases/2022/redistribution#visual-c-runtime-files).
The last, ucrtbased.dll, I found under C:\Program Files (x86)\WIndows Kits\10\bin...