jpnurmi / flutter_libserialport

Serial Port for Flutter
https://pub.dev/packages/flutter_libserialport
MIT License
139 stars 80 forks source link

Can't run android app #98

Closed unleed-l closed 2 months ago

unleed-l commented 3 months ago

When I try to run my application with flutter_libserialport installed, I get this error:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_libserialport:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/android/.cxx/Debug/x732l624/arm64-v8a'
  [1/2] Building C object CMakeFiles/serialport.dir/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c.o
  FAILED: CMakeFiles/serialport.dir/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c.o
  /Users/objetivodev/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=aarch64-none-linux-android21 --gcc-toolchain=/Users/objetivodev/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/objetivodev/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DLIBSERIALPORT_ATBUILD -Dserialport_EXPORTS -I/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/android/libserialport -I/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/android/libserialport/../../third_party/libserialport -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 -std=c99 -Wall -Wextra -pedantic -Wmissing-prototypes -Wshadow -MD -MT CMakeFiles/serialport.dir/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c.o -MF CMakeFiles/serialport.dir/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c.o.d -o CMakeFiles/serialport.dir/Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c.o -c /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:98:9: error: invalid application of 'sizeof' to an incomplete type 'struct termiox'
          return sizeof(struct termiox);
                 ^     ~~~~~~~~~~~~~~~~
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:98:23: note: forward declaration of 'struct termiox'
          return sizeof(struct termiox);
                               ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:106:15: error: incomplete definition of type 'struct termiox'
          *rts = (termx->x_cflag & RTSXOFF);
                  ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:103:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:106:27: error: use of undeclared identifier 'RTSXOFF'
          *rts = (termx->x_cflag & RTSXOFF);
                                   ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:107:15: error: incomplete definition of type 'struct termiox'
          *cts = (termx->x_cflag & CTSXON);
                  ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:103:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:107:27: error: use of undeclared identifier 'CTSXON'
          *cts = (termx->x_cflag & CTSXON);
                                   ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:108:15: error: incomplete definition of type 'struct termiox'
          *dtr = (termx->x_cflag & DTRXOFF);
                  ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:103:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:108:27: error: use of undeclared identifier 'DTRXOFF'
          *dtr = (termx->x_cflag & DTRXOFF);
                                   ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:109:15: error: incomplete definition of type 'struct termiox'
          *dsr = (termx->x_cflag & DSRXON);
                  ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:103:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:109:27: error: use of undeclared identifier 'DSRXON'
          *dsr = (termx->x_cflag & DSRXON);
                                   ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:118:7: error: incomplete definition of type 'struct termiox'
          termx->x_cflag &= ~(RTSXOFF | CTSXON | DTRXOFF | DSRXON);
          ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:116:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:118:22: error: use of undeclared identifier 'RTSXOFF'
          termx->x_cflag &= ~(RTSXOFF | CTSXON | DTRXOFF | DSRXON);
                              ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:118:32: error: use of undeclared identifier 'CTSXON'
          termx->x_cflag &= ~(RTSXOFF | CTSXON | DTRXOFF | DSRXON);
                                        ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:118:41: error: use of undeclared identifier 'DTRXOFF'
          termx->x_cflag &= ~(RTSXOFF | CTSXON | DTRXOFF | DSRXON);
                                                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:118:51: error: use of undeclared identifier 'DSRXON'
          termx->x_cflag &= ~(RTSXOFF | CTSXON | DTRXOFF | DSRXON);
                                                           ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:121:8: error: incomplete definition of type 'struct termiox'
                  termx->x_cflag |= RTSXOFF;
                  ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:116:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:121:21: error: use of undeclared identifier 'RTSXOFF'
                  termx->x_cflag |= RTSXOFF;
                                    ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:123:8: error: incomplete definition of type 'struct termiox'
                  termx->x_cflag |= CTSXON;
                  ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:116:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:123:21: error: use of undeclared identifier 'CTSXON'
                  termx->x_cflag |= CTSXON;
                                    ^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:125:8: error: incomplete definition of type 'struct termiox'
                  termx->x_cflag |= DTRXOFF;
                  ~~~~~^
  /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/third_party/libserialport/linux_termios.c:116:9: note: forward declaration of 'struct termiox'
          struct termiox *termx = (struct termiox *) data;
                 ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /Users/objetivodev/Library/Android/sdk/cmake/3.18.1/bin/ninja \
        -C \
        /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/android/.cxx/Debug/x732l624/arm64-v8a \
        serialport
    from /Users/objetivodev/.pub-cache/hosted/pub.dev/flutter_libserialport-0.3.0/android

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Exception: Gradle task assembleDebug failed with exit code 1

Exited (1).
LeoBound commented 3 months ago

I had the same issue when trying to update my Gradle plugin (in android/build.gradle). I'm not sure what, but the build process seems to be broken by Gradle 7.3.0 and higher, using classpath 'com.android.tools.build:gradle:7.2.2' seems to work as expected.