Search code examples
windowsflutterdart

Why am I getting this error when building flutter app for windows?


I am trying to use my app as a windows desktop, but I get this error in the console:

Building Windows application...
CMake Error at flutter/ephemeral/.plugin_symlinks/native_pdf_renderer/windows/DownloadProject.cmake:179 (message):
Build step for pdfium failed: 1
Call Stack (most recent call first):
flutter/ephemeral/.plugin_symlinks/native_pdf_renderer/windows/CMakeLists.txt:16 (download_project)


Exception: Unable to generate build files

Tried to look for similar error but did not find something like this.


Solution

  • Before the pull request was merged, this is a known issue as mentioned in the comment.

    The only way to solve this is by adding the line

    set(PDFIUM_VERSION "4634" CACHE STRING "")
    

    into your CMakeLists.txt file as mentioned here.

    @hillelcoren It seems that the upstream repository has cleared out some of the release artifacts we were using. I've opened a pull request #241 to fix this but in the meantime you can also work around this by adding

    set(PDFIUM_VERSION "4634" CACHE STRING "")
    

    to your windows/cmakelists.txt file (you may need to run flutter clean after this).

    There is also the .zip vs .tgz issue that you've spotted but this only affects the most recent pdfium versions, I was waiting for their release process to stabilize before pushing a PR to address this.

    Currently, the pull request have been merged and should resolve the issue relating to this.