AgoraIO-Extensions / iris_method_channel_flutter

iris_method_channel is a method channel that communicate between C/C++(iris) and dart, which is used by Agora Flutter SDKs.
MIT License
2 stars 3 forks source link

cmake build fails on flutter run #54

Closed Heaust-ops closed 1 year ago

Heaust-ops commented 1 year ago

Hi, I'm using agora_uikit as a package in my flutter app that installs this package as a dependency

However when I run the project, iris_method_channel fails to compile with errors, (compiling this for an android emulator with sdk version 33)

I'm using the latest stable versions of flutter at the time of posting,

here are the agora and iris versions that are installed,

I have limited experience in c/c++ and I would really appreciate any help to identify and fix the problem or any workarounds

Thank you so much,

Below are the logs

Execution failed for task ':iris_method_channel:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/home/heaust/.pub-cache/hosted/pub.dev/iris_method_channel-1.1.0-rc.5/android/.cxx/Debug/722d6s2f/arm64-v8a'
  [1/4] Building C object CMakeFiles/iris_method_channel.dir/dart-sdk/include/dart_api_dl.c.o
  [2/4] Building CXX object CMakeFiles/iris_method_channel.dir/iris_life_cycle_observer.cc.o
  [3/4] Building CXX object CMakeFiles/iris_method_channel.dir/iris_event.cc.o
  FAILED: CMakeFiles/iris_method_channel.dir/iris_event.cc.o 
  /opt/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/opt/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/opt/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DDART_SHARED_LIB -Diris_method_channel_EXPORTS  -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/iris_method_channel.dir/iris_event.cc.o -MF CMakeFiles/iris_method_channel.dir/iris_event.cc.o.d -o CMakeFiles/iris_method_channel.dir/iris_event.cc.o -c /home/heaust/.pub-cache/hosted/pub.dev/iris_method_channel-1.1.0-rc.5/src/iris_event.cc
  In file included from /home/heaust/.pub-cache/hosted/pub.dev/iris_method_channel-1.1.0-rc.5/src/iris_event.cc:6:
  /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);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/heaust/.pub-cache/hosted/pub.dev/iris_method_channel-1.1.0-rc.5/src/iris_event.cc:90:17: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
                  memcpy(abuffer, obuffer, abufferLength);
                  ^~~~~~
                  wmemcpy
  /snap/flutter/current/usr/include/wchar.h:262:17: note: 'wmemcpy' declared here
  extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
                  ^
  /home/heaust/.pub-cache/hosted/pub.dev/iris_method_channel-1.1.0-rc.5/src/iris_event.cc:90:24: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'uint8_t *' (aka 'unsigned char *')
                  memcpy(abuffer, obuffer, abufferLength);
                         ^~~~~~~
  /snap/flutter/current/usr/include/wchar.h:262:46: note: passing argument to parameter '__s1' here
  extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
                                               ^
  3 errors generated.
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /opt/android-sdk/cmake/3.18.1/bin/ninja \
        -C \
        /home/heaust/.pub-cache/hosted/pub.dev/iris_method_channel-1.1.0-rc.5/android/.cxx/Debug/722d6s2f/arm64-v8a \
        iris_method_channel
    from /home/heaust/.pub-cache/hosted/pub.dev/iris_method_channel-1.1.0-rc.5/android
littleGnAl commented 1 year ago

duplicated https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/1086