Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error, maybe the dart sdk version ? #1

Closed
lycstar opened this issue Feb 1, 2022 · 5 comments
Closed

Compile error, maybe the dart sdk version ? #1

lycstar opened this issue Feb 1, 2022 · 5 comments

Comments

@lycstar
Copy link

lycstar commented Feb 1, 2022

Info: Compiling with sound null safety
lib/src/ffi.dart:23:5: Error: Can't create typedef from non-function type.
    = Pointer<NativeFunction<Void Function(Pointer<Uint8>, UintPtr, Pointer)>>;
    ^
lib/src/ffi.dart:30:39: Error: Can't create typedef from non-function type.
typedef FlutterDesktopMessageCallback = Pointer<
                                      ^
lib/src/ffi.dart:44:50: Error: Can't create typedef from non-function type.
typedef FlutterDesktopPixelBufferTextureCallback = Pointer<
                                                 ^
lib/src/ffi.dart:50:50: Error: Can't create typedef from non-function type.
typedef FlutterDesktopOnPluginRegistrarDestroyed = Pointer<
                                                 ^
lib/src/ffi.dart:23:60: Error: Type 'UintPtr' not found.
    = Pointer<NativeFunction<Void Function(Pointer<Uint8>, UintPtr, Pointer)>>;
                                                           ^^^^^^^
lib/src/ffi.dart:47:13: Error: Type 'UintPtr' not found.
            UintPtr, UintPtr, Pointer)>>;
            ^^^^^^^
lib/src/ffi.dart:47:22: Error: Type 'UintPtr' not found.
            UintPtr, UintPtr, Pointer)>>;
                     ^^^^^^^
lib/src/ffi.dart:192:31: Error: 'UintPtr' isn't a type.
              Pointer<Uint8>, UintPtr)>>('FlutterDesktopMessengerSend');
                              ^^^^^^^
lib/src/ffi.dart:223:15: Error: 'UintPtr' isn't a type.
              UintPtr,
              ^^^^^^^
lib/src/ffi.dart:254:15: Error: 'UintPtr' isn't a type.
              UintPtr)>>('FlutterDesktopMessengerSendResponse');
              ^^^^^^^
lib/src/ffi.dart:79:4: Error: Couldn't find constructor 'UintPtr'.
  @UintPtr()
   ^^^^^^^
lib/src/ffi.dart:89:4: Error: Couldn't find constructor 'UintPtr'.
  @UintPtr()
   ^^^^^^^
lib/src/ffi.dart:103:4: Error: Couldn't find constructor 'UintPtr'.
  @UintPtr()
   ^^^^^^^
lib/src/ffi.dart:107:4: Error: Couldn't find constructor 'UintPtr'.
  @UintPtr()
   ^^^^^^^
lib/src/ffi.dart:80:16: Error: Field 'struct_size' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
  external int struct_size;
               ^
lib/src/ffi.dart:90:16: Error: Field 'message_size' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
  external int message_size;
               ^
lib/src/ffi.dart:104:16: Error: Field 'width' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
  external int width;
               ^
lib/src/ffi.dart:108:16: Error: Field 'height' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
  external int height;
               ^
lib/src/ffi.dart:120:53: Error: Field 'callback' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
  external FlutterDesktopPixelBufferTextureCallback callback;
                                                    ^
lib/src/ffi.dart:194:39: Error: Expected type 'NativeFunction<Int32 Function(Pointer<FlutterDesktopMessenger>, Pointer<Int8>, Pointer<Uint8>, invalid-type)>' to be a valid and instantiated subtype of 'NativeType'.
 - 'NativeFunction' is from 'dart:ffi'.
 - 'Int32' is from 'dart:ffi'.
 - 'Pointer' is from 'dart:ffi'.
 - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
 - 'Int8' is from 'dart:ffi'.
 - 'Uint8' is from 'dart:ffi'.
      _FlutterDesktopMessengerSendPtr.asFunction<
                                      ^
lib/src/ffi.dart:227:48: Error: Expected type 'NativeFunction<Int32 Function(Pointer<FlutterDesktopMessenger>, Pointer<Int8>, Pointer<Uint8>, invalid-type, invalid-type, Pointer<NativeType>)>' to be a valid and instantiated subtype of 'NativeType'.
 - 'NativeFunction' is from 'dart:ffi'.
 - 'Int32' is from 'dart:ffi'.
 - 'Pointer' is from 'dart:ffi'.
 - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
 - 'Int8' is from 'dart:ffi'.
 - 'Uint8' is from 'dart:ffi'.
 - 'NativeType' is from 'dart:ffi'.
      _FlutterDesktopMessengerSendWithReplyPtr.asFunction<
                                               ^
lib/src/ffi.dart:256:47: Error: Expected type 'NativeFunction<Void Function(Pointer<FlutterDesktopMessenger>, Pointer<FlutterDesktopMessageResponseHandle>, Pointer<Uint8>, invalid-type)>' to be a valid and instantiated subtype of 'NativeType'.
 - 'NativeFunction' is from 'dart:ffi'.
 - 'Void' is from 'dart:ffi'.
 - 'Pointer' is from 'dart:ffi'.
 - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
 - 'FlutterDesktopMessageResponseHandle' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
 - 'Uint8' is from 'dart:ffi'.
      _FlutterDesktopMessengerSendResponsePtr.asFunction<
                                              ^
lib/src/ffi.dart:292:46: Error: Expected type 'NativeFunction<Void Function(Pointer<FlutterDesktopMessenger>, Pointer<Int8>, invalid-type, Pointer<NativeType>)>' to be a valid and instantiated subtype of 'NativeType'.
 - 'NativeFunction' is from 'dart:ffi'.
 - 'Void' is from 'dart:ffi'.
 - 'Pointer' is from 'dart:ffi'.
 - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
 - 'Int8' is from 'dart:ffi'.
 - 'NativeType' is from 'dart:ffi'.
      _FlutterDesktopMessengerSetCallbackPtr.asFunction<
                                             ^
lib/src/ffi.dart:423:62: Error: Expected type 'NativeFunction<Void Function(Pointer<FlutterDesktopPluginRegistrar>, invalid-type)>' to be a valid and instantiated subtype of 'NativeType'.
 - 'NativeFunction' is from 'dart:ffi'.
 - 'Void' is from 'dart:ffi'.
 - 'Pointer' is from 'dart:ffi'.
 - 'FlutterDesktopPluginRegistrar' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
      _FlutterDesktopPluginRegistrarSetDestructionHandlerPtr.asFunction<
                                                             ^
Error: AOT compilation failed
Generating AOT kernel dill failed!
Dart SDK version: 2.17.0-49.0.dev (dev) (Sun Jan 23 14:30:49 2022 -0800) on "windows_x64"
@lycstar lycstar changed the title Compile error, maybe the version is inconsistent Compile error, maybe the dart sdk version ? Feb 1, 2022
@domesticmouse
Copy link
Contributor

This is WFM on latest master Flutter.

PS c:\> dart --version
Dart SDK version: 2.17.0-69.0.dev (dev) (Fri Jan 28 00:44:27 2022 -0800) on "windows_x64"

@timsneath
Copy link
Contributor

There's some flux at the moment with package:ffi adding some types in 1.2.0 that I'd unwittingly used:
https://pub.dev/packages/ffi/versions/1.2.0-dev.0

I think they're about to publish this, but for now, try editing pubspec.yaml to point to this new version of ffi, and you should be good, @lycstar.

@lycstar
Copy link
Author

lycstar commented Feb 2, 2022

@timsneath ok , but a new error was encountered

Info: Compiling with sound null safety
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/win32-2.3.10/lib/src/structs.g.dart:664:31: Error: Member not found: 'UnicodeChar'.
  int get UnicodeChar => Char.UnicodeChar;
                              ^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/win32-2.3.10/lib/src/structs.g.dart:665:38: Error: Setter not found: 'UnicodeChar'.
  set UnicodeChar(int value) => Char.UnicodeChar = value;
                                     ^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/win32-2.3.10/lib/src/structs.g.dart:667:29: Error: Member not found: 'AsciiChar'.
  int get AsciiChar => Char.AsciiChar;
                            ^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/win32-2.3.10/lib/src/structs.g.dart:668:36: Error: Setter not found: 'AsciiChar'.
  set AsciiChar(int value) => Char.AsciiChar = value;
                                   ^^^^^^^^^
Error: AOT compilation failed
Generating AOT kernel dill failed!
Dart SDK version: 2.17.0-69.0.dev (dev) (Fri Jan 28 00:44:27 2022 -0800) on "windows_x64"

@timsneath
Copy link
Contributor

I'm so glad you reported this, because it helped us track down a nasty potential bug caused by the interplay of some types that were temporarily in both package:ffi and dart:ffi in certain situations (see dart-archive/ffi#133). We fixed the parent package, and commit 3deb30a should fix errors here. Please let me know if this works for you.

@lycstar
Copy link
Author

lycstar commented Feb 8, 2022

Great, it works! @timsneath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants