espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of pdfium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
60 stars 36 forks source link

Can't start app while using pdfrx: ^1.0.51 #116

Closed Dabbit-Chan closed 1 month ago

Dabbit-Chan commented 1 month ago

It show out Execution failed for task ':pdfrx:configureCMakeDebug[arm64-v8a]' and here is the log.

CMake Warning at C:/Users/David Chan/AppData/Local/Android/Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    C:/Users/David Chan/AppData/Local/Android/Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    C:/Users/David Chan/AppData/Local/Android/Sdk/cmake/3.18.1/share/cmake-3.18/Modules/CMakeDetermineSystem.cmake:93 (include)
    CMakeLists.txt:5 (project)

  CMake Warning at C:/Users/David Chan/AppData/Local/Android/Sdk/ndk/23.1.7779620/build/cmake/android-legacy.toolchain.cmake:416 (message):
    An old version of CMake is being used that cannot automatically detect
    compiler attributes.  Compiler identification is being bypassed.  Some
    values may be wrong or missing.  Update to CMake 3.19 or newer to use
    CMake's built-in compiler identification.
  Call Stack (most recent call first):
    C:/Users/David Chan/AppData/Local/Android/Sdk/ndk/23.1.7779620/build/cmake/android.toolchain.cmake:55 (include)
    C:/Users/David Chan/AppData/Local/Pub/Cache/hosted/pub.dev/pdfrx-1.0.51/android/.cxx/Debug/4u6s1z44/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake:6 (include)
    C:/Users/David Chan/AppData/Local/Pub/Cache/hosted/pub.dev/pdfrx-1.0.51/android/.cxx/Debug/4u6s1z44/arm64-v8a/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)

  CMake Error at CMakeLists.txt:67 (file):
    file failed to create symbolic link 'C:/Users/David
    Chan/AppData/Local/Pub/Cache/hosted/pub.dev/pdfrx-1.0.51/android/.lib/latest':
    operation not permitted

  CMake Warning (dev) at CMakeLists.txt:71 (set):
    Cannot set "pdfrx_bundled_libraries": current scope has no parent.
  This warning is for project developers.  Use -Wno-dev to suppress it.
flutter doctor

[√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [版本 10.0.19045.4170], locale zh-CN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio 生成工具 2022 17.4.0)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2023.2)
[√] VS Code (version 1.86.2)
[√] Connected device (4 available)
[!] Network resources                   
    X A network error occurred while checking "https://maven.google.com/": 信号灯超时时间已到

! Doctor found issues in 2 categories.
espresso3389 commented 1 month ago

The error is self-explaining:

An old version of CMake is being used that cannot automatically detect compiler attributes. Compiler identification is being bypassed. Some values may be wrong or missing. Update to CMake 3.19 or newer to use CMake's built-in compiler identification.

Normally, cmake is automatically installed by flutter/Android toolchain. But something prevents it from working correctly. The actual cause may vary and I'm not sure what causes the issue on your environment.

So, anyway, could you please do the following things:

Dabbit-Chan commented 1 month ago

Here is my Android Studio version, I don't think it needs an update.

Android Studio Iguana | 2023.2.1
Build #AI-232.10227.8.2321.11479570, built on February 22, 2024
Runtime version: 17.0.9+0--11185874 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4084M
Cores: 16
Non-Bundled Plugins:
    Dart (232.10305)
    GrepConsole (12.14.211.6693.0)
    zielu.gittoolbox (500.2.3+223)
    io.flutter (78.4.1)
Dabbit-Chan commented 1 month ago

After using cmake: 3.22.1 and ndk: 26.2.11394342 also enable Windows' Developer mode, I get the following errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':pdfrx:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `C:\Users\David Chan\AppData\Local\Pub\Cache\hosted\pub.dev\pdfrx-1.0.51\android\.cxx\Debug\5n586p4x\arm64-v8a'

  C++ build system [build] failed while executing:
      @echo off
      "C:\\Users\\David Chan\\AppData\\Local\\Android\\sdk\\cmake\\3.22.1\\bin\\ninja.exe" ^
        -C ^
        "C:\\Users\\David Chan\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\pdfrx-1.0.51\\android\\.cxx\\Debug\\5n586p4x\\arm64-v8a" ^
        pdfrx
    from C:\Users\David Chan\AppData\Local\Pub\Cache\hosted\pub.dev\pdfrx-1.0.51\android
  ninja: error: '../../../../.lib/latest/arm64-v8a/libpdfium.so', needed by 'D:/flutter_project/***/build/pdfrx/intermediates/cxx/Debug/5n586p4x/obj/arm64-v8a/libpdfrx.so', missing and no known rule to make it
Dabbit-Chan commented 1 month ago

I tried it a few more times without changing anything and suddenly it worked...

espresso3389 commented 1 month ago

I tried it a few more times without changing anything and suddenly it worked...

Yes, so I don't know the actual cause... Need reboot or such?

Dabbit-Chan commented 1 month ago

I think a new version of ndk and cmake and enable developer mode will solve the problem. No need for reboot.