onepub-dev / dart_posix

MIT License
12 stars 4 forks source link

ffi error with Dart 3 #12

Closed jodinathan closed 1 year ago

jodinathan commented 1 year ago

when trying to run a console app:

posix-4.1.0/lib/src/pwd.dart:322:35: Error: Field 'name' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`.
  external ffi.Pointer<ffi.Int8>? name;

dart version Dart SDK version: 3.0.0-263.0.dev (dev) (Tue Feb 21 17:59:38 2023 -0800) on "macos_x64"

nikage commented 1 year ago

I'm encountering the same issue with compilation error when running $ pub global activate get_cli. The error message is as follows:

../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:885:35: Error: Field '_unique___names_item_12' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`.
  external ffi.Pointer<ffi.Int8>? _unique___names_item_12;
$ flutter --version
Flutter 3.9.0-0.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 0df8557c56 (9 days ago) • 2023-03-23 22:02:01 -0500
Engine • revision 1cc4b2d280
Tools • Dart 3.0.0 (build 3.0.0-290.3.beta) • DevTools 2.22.2

I use MBP m1

$ sw_vers
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115
Full error log ``` Failed to build get_cli:get: ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/pwd.dart:322:35: Error: Field 'name' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? name; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/pwd.dart:326:35: Error: Field 'password' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? password; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/pwd.dart:330:17: Error: Field 'uid' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external int? uid; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/pwd.dart:334:17: Error: Field 'gid' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external int? gid; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/pwd.dart:337:35: Error: Field 'gecos' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? gecos; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/pwd.dart:340:35: Error: Field 'dir' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? dir; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/pwd.dart:343:35: Error: Field 'shell' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? shell; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/grp.dart:369:35: Error: Field 'name' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? name; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/grp.dart:372:35: Error: Field 'passwd' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? passwd; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/grp.dart:376:17: Error: Field 'gid' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external int? gid; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/grp.dart:379:48: Error: Field 'mem' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer>? mem; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:830:38: Error: Field '_unique___locales_item_0' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_0; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:832:38: Error: Field '_unique___locales_item_1' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_1; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:834:38: Error: Field '_unique___locales_item_2' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_2; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:836:38: Error: Field '_unique___locales_item_3' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_3; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:838:38: Error: Field '_unique___locales_item_4' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_4; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:840:38: Error: Field '_unique___locales_item_5' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_5; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:842:38: Error: Field '_unique___locales_item_6' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_6; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:844:38: Error: Field '_unique___locales_item_7' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_7; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:846:38: Error: Field '_unique___locales_item_8' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_8; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:848:38: Error: Field '_unique___locales_item_9' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_9; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:850:38: Error: Field '_unique___locales_item_10' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_10; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:852:38: Error: Field '_unique___locales_item_11' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_11; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:854:38: Error: Field '_unique___locales_item_12' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___locales_item_12; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:861:35: Error: Field '_unique___names_item_0' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_0; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:863:35: Error: Field '_unique___names_item_1' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_1; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:865:35: Error: Field '_unique___names_item_2' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_2; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:867:35: Error: Field '_unique___names_item_3' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_3; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:869:35: Error: Field '_unique___names_item_4' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_4; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:871:35: Error: Field '_unique___names_item_5' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_5; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:873:35: Error: Field '_unique___names_item_6' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_6; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:875:35: Error: Field '_unique___names_item_7' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_7; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:877:35: Error: Field '_unique___names_item_8' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_8; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:879:35: Error: Field '_unique___names_item_9' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_9; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:881:35: Error: Field '_unique___names_item_10' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_10; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:883:35: Error: Field '_unique___names_item_11' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_11; ^ ../.pub-cache/hosted/pub.dev/posix-4.1.0/lib/src/string/string.dart:885:35: Error: Field '_unique___names_item_12' cannot be nullable or have type 'Null', it must be `int`, `double`, `Pointer`, or a subtype of `Struct` or `Union`. external ffi.Pointer? _unique___names_item_12; ```
shamblett commented 1 year ago

I'm seeing these errors also, +1

Skycoder42 commented 1 year ago

The 4.2.0 tag seems to work when directly referencing it as git tag. Why has it not been released on pub.dev yet?

bsutton commented 1 year ago

So the problem was layered 1) I had a circular dependency issue with dcli. So I started on breaking dcli into multiple smaller package to remove this sort of problem. 2) my laptop died so my evening work on dcli halted until I came to the realization that I need to buy a new laptop as my old one wasn't retrievable. 3) By the time I got the new lap top I got distracted by the dcli work and completely forgot that I hadn't released this version.

:<

bsutton commented 1 year ago

I will try to get a release happening over the weekend.

shamblett commented 1 year ago

Great, thanks

bsutton commented 1 year ago

dart_posix 5.0.0 has now being published. This appears to resolve the problem.

Please take it for a spin and let me know how it goes.

Skycoder42 commented 1 year ago

Works for me, thank you :)

shamblett commented 1 year ago

And me, thanks