kekland / croppy

A fully customizable image cropper for Flutter, in Flutter
MIT License
105 stars 30 forks source link

build error on arm64-v8a #14

Closed fortunado closed 1 year ago

fortunado commented 1 year ago

Hello! I was trying to build example with CustomCropper and have build error when targeting device:

croppy-1.1.4

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':croppy:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/android/.cxx/Debug/1d3nc5hj/arm64-v8a'
  [1/2] Building CXX object CMakeFiles/croppy.dir/fit_polygon_in_quad.cpp.o
  FAILED: CMakeFiles/croppy.dir/fit_polygon_in_quad.cpp.o 
  /home/fortunado/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/fortunado/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/fortunado/Android/Sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DDART_SHARED_LIB -Dcroppy_EXPORTS -I/home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/kiwi -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/croppy.dir/fit_polygon_in_quad.cpp.o -MF CMakeFiles/croppy.dir/fit_polygon_in_quad.cpp.o.d -o CMakeFiles/croppy.dir/fit_polygon_in_quad.cpp.o -c /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/fit_polygon_in_quad.cpp
  In file included from /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/fit_polygon_in_quad.cpp:1:
  In file included from /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/kiwi/kiwi.h:9:
  In file included from /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/kiwi/constraint.h:12:
  In file included from /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/kiwi/expression.h:10:
  In file included from /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/kiwi/term.h:10:
  In file included from /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/src/kiwi/variable.h:9:
  /snap/flutter/current/usr/include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information
    const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /home/fortunado/Android/Sdk/cmake/3.18.1/bin/ninja \
        -C \
        /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/android/.cxx/Debug/1d3nc5hj/arm64-v8a \
        croppy
    from /home/fortunado/.pub-cache/hosted/pub.dev/croppy-1.1.4/android

Android Studio

Android Studio Giraffe | 2022.3.1 Patch 1
Build #AI-223.8836.35.2231.10671973, built on August 17, 2023
Runtime version: 17.0.6+0-17.0.6b829.9-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.2.0-33-generic
GC: G1 Young Generation, G1 Old Generation

Non-Bundled Plugins:
    String Manipulation (9.11.3)
    Dart (223.8950)
    io.flutter (75.1.2)

Current Desktop: ubuntu:GNOME

ndkVersion "23.1.7779620"

Bug or other ndk needed? Thank you.

kekland commented 1 year ago

Hi!

The logs indicate that the error is coming from /snap/flutter/current/usr/include/c++/9/memory:121:25, not from croppy itself. After checking the snap repo for Flutter, found this https://github.com/canonical/flutter-snap/issues/83, but without any solutions as of yet.

I'll link this issue there.

kekland commented 1 year ago

A possible solution might be to try to install Flutter via git, not through snap (as indicated in https://github.com/rive-app/rive-flutter/issues/323#issuecomment-1710148004)

fortunado commented 1 year ago

@kekland Thank you for your help! Solved by: manually installing flutter