flutter_tts icon indicating copy to clipboard operation
flutter_tts copied to clipboard

Windows build fail

Open kittyliujc opened this issue 7 months ago • 17 comments

🐛 Bug Report

Commit c04dd43 build fail

Expected behavior

build pass

Reproduction steps

build code

Please remove "ARGS install "Microsoft.Windows.CppWinRT" -Version 2.0.210503.1 -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages)" in Windows\CMakeLists.txt

Platform: Windows

kittyliujc avatar Jun 13 '25 03:06 kittyliujc

https://github.com/dlutton/flutter_tts/pull/591

saif-ellafi avatar Jun 17 '25 12:06 saif-ellafi

Same problem. Cannot build Windows version. Get error

CMake Error at flutter/ephemeral/.plugin_symlinks/flutter_tts/windows/CMakeLists.txt:18: Parse error. Expected "(", got identifier with text "install".

robertonic avatar Jun 18 '25 09:06 robertonic

I get the same error on versions 4.0.0 and 4.2.3 (the error does not appear in 3.8.0):

Launching lib\main.dart on Windows in debug mode...
Building Windows application...
CMake Error at flutter/ephemeral/.plugin_symlinks/flutter_tts/windows/CMakeLists.txt:18:
  Parse error.  Expected "(", got identifier with text "install".

Error: Unable to generate build files

ChristianKleineidam avatar Jun 20 '25 06:06 ChristianKleineidam

Thanks Christian. I'll try reverting to 3.8.0 until the problem is fixed.

robertonic avatar Jun 20 '25 07:06 robertonic

change them like this:

################ NuGet install begin ################
find_program(NUGET_EXE NAMES nuget)
if(NOT NUGET_EXE)
    message("NUGET.EXE not found.")
    message(FATAL_ERROR "Please install this executable, and run CMake again.")
endif()

execute_process(
    COMMAND ${NUGET_EXE}
            install
            Microsoft.Windows.CppWinRT
            -Version 2.0.210503.1
            -ExcludeVersion
            -OutputDirectory ${CMAKE_BINARY_DIR}/packages
)
################ NuGet install end ################

Metaildust avatar Jun 29 '25 22:06 Metaildust

@Metaildust If you do have an idea of how the fix works, how about create a pull request?

ChristianKleineidam avatar Jun 30 '25 05:06 ChristianKleineidam

+1

v4.2.3

SpringHgui avatar Jul 07 '25 01:07 SpringHgui

fix pls

vienhp1996 avatar Jul 19 '25 12:07 vienhp1996

fix pls

done

Metaildust avatar Jul 19 '25 12:07 Metaildust

I have built using:

  flutter_tts:
    git:
      url: https://github.com/Metaildust/flutter_tts.git
      ref: patch-1
flutter clean
flutter build windows

But I get unresolved external symbols:

flutter_tts_plugin.obj : error LNK2019: unresolved external symbol WINRT_IMPL_RoGetActivationFactory referenced in function "struct winrt::hresult __cdecl winrt::impl::get_runtime_activation_factory_impl<1>(struct winrt::param::hstring const &,struct winrt::guid const &,void * *)" (??$get_runtime_activation_factory_impl@$00@impl@winrt@@YA?AUhresult@1@AEBUhstring@param@1@AEBUguid@1@PEAPEAX@Z) [C:\Users\xyz\my_app\build\windows\x64\plugins\flutter_tts\flutter_tts_plugin.vcxproj]
...

Has other people been able to use the Metaildust branch and get building to work?

lea108 avatar Aug 07 '25 11:08 lea108

@lea108 I solved this by adding windowsapp to the CMakeLists.txt files

in windows\runner\CMakeLists.txt add target_link_libraries(${BINARY_NAME} PRIVATE windowsapp) after target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)

in windows\flutter\ephemeral\.plugin_symlinks\flutter_tts\windows\CMakeLists.txt and target_link_libraries(${PLUGIN_NAME} PRIVATE windowsapp) after target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)

note: Folders in the .plugin_symlinks directory are symbolic links to packages located at C:\Users\<your-username>\AppData\Local\Pub\Cache\hosted\pub.dev. This means that if you change the version of flutter_tts, the linked folder may be replaced with a new version that does not include your changes

sipasi avatar Aug 10 '25 17:08 sipasi

change them like this:

################ NuGet install begin ################
find_program(NUGET_EXE NAMES nuget)
if(NOT NUGET_EXE)
    message("NUGET.EXE not found.")
    message(FATAL_ERROR "Please install this executable, and run CMake again.")
endif()

execute_process(
    COMMAND ${NUGET_EXE}
            install
            Microsoft.Windows.CppWinRT
            -Version 2.0.210503.1
            -ExcludeVersion
            -OutputDirectory ${CMAKE_BINARY_DIR}/packages
)
################ NuGet install end ################

This does solve the problem. If someone is wondering how to use this (like I was), find CMakeLists.txt (In your project: windows/flutter/ephemeral/.plugin_symlinks/flutter_tts/windows/CMakeLists.txt), then change it like described above (or simply remove/comment:

ARGS install "Microsoft.Windows.CppWinRT" -Version 2.0.210503.1 -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages)

).

I had this problem when using the most recent version of flutter_tts (4.2.3 at the time of this writing).

Ri-car-do-1989 avatar Aug 29 '25 16:08 Ri-car-do-1989

Please fix this.

robertonic avatar Sep 11 '25 20:09 robertonic

build once first then change CMakeLists.txt like i've shown above it will work > Please fix this.

Metaildust avatar Sep 11 '25 21:09 Metaildust

Please fix this. Thanks 🙏

takacsalbert avatar Sep 16 '25 12:09 takacsalbert

Please fix this. Thanks 🙏

bajizhh avatar Sep 19 '25 01:09 bajizhh

any fix?

SadraKafiri avatar Oct 09 '25 10:10 SadraKafiri