Skip to content

Dart 3.0.0-417.1.beta is breaking ffigen generated code #52074

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

Closed
domesticmouse opened this issue Apr 18, 2023 · 6 comments
Closed

Dart 3.0.0-417.1.beta is breaking ffigen generated code #52074

domesticmouse opened this issue Apr 18, 2023 · 6 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi
Milestone

Comments

@domesticmouse
Copy link
Member

Context: https://github.com/flutter/codelabs/tree/main/ffigen_codelab/ and https://codelabs.developers.google.com/codelabs/flutter-ffigen

I'm attempting to update the codelabs for Flutter 3.10 and Dart 3, but I'm hitting a ffigen code generation issue. On attempting to build step_06 of the updated codelab, I'm seeing the following error logs:

In file included from /Users/brettmorgan/Documents/GitHub/codelabs/ffigen_codelab/step_06/macos/Classes/duktape.c:3:
duk_bi_date.c:311:34: warning: implicit conversion loses integer precision: 'unsigned long' to 'duk_uint_fast32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
                        match_val = (1UL << part_idx) + (1UL << (sep_idx + 9)); /* match against rule part/sep bits */
                                  ~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
../lib/duktape_bindings_generated.dart:5155:7: Error: The type 'duk_thread_state' must be 'base', 'final' or 'sealed' because the supertype 'Struct' is 'base'.
Try adding 'base', 'final', or 'sealed' to the type.
class duk_thread_state extends ffi.Struct {
      ^
../lib/duktape_bindings_generated.dart:5160:7: Error: The type 'duk_memory_functions' must be 'base', 'final' or 'sealed' because the supertype 'Struct' is 'base'.
Try adding 'base', 'final', or 'sealed' to the type.
class duk_memory_functions extends ffi.Struct {
      ^
../lib/duktape_bindings_generated.dart:5186:7: Error: The type 'duk_function_list_entry' must be 'base', 'final' or 'sealed' because the supertype 'Struct' is 'base'.
Try adding 'base', 'final', or 'sealed' to the type.
class duk_function_list_entry extends ffi.Struct {
      ^
../lib/duktape_bindings_generated.dart:5212:7: Error: The type 'duk_hthread' must be 'base', 'final' or 'sealed' because the supertype 'Opaque' is 'base'.
Try adding 'base', 'final', or 'sealed' to the type.
class duk_hthread extends ffi.Opaque {}
      ^
../lib/duktape_bindings_generated.dart:5218:7: Error: The type 'duk_number_list_entry' must be 'base', 'final' or 'sealed' because the supertype 'Struct' is 'base'.
Try adding 'base', 'final', or 'sealed' to the type.
class duk_number_list_entry extends ffi.Struct {
      ^
../lib/duktape_bindings_generated.dart:5227:7: Error: The type 'duk_time_components' must be 'base', 'final' or 'sealed' because the supertype 'Struct' is 'base'.
Try adding 'base', 'final', or 'sealed' to the type.
class duk_time_components extends ffi.Struct {
      ^
Target kernel_snapshot failed: Exception

Command PhaseScriptExecution failed with a nonzero exit code
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **

Obligatory flutter doctor -v output:

$ flutter doctor -v
[✓] Flutter (Channel beta, 3.10.0-1.1.pre, on macOS 13.4 22F5037d darwin-arm64, locale en)
    • Flutter version 3.10.0-1.1.pre on channel beta at /Users/brettmorgan/flutter
    • Upstream repository https://github.com/flutter/flutter
    • Framework revision ecdb7841df (6 days ago), 2023-04-11 20:47:40 -0700
    • Engine revision 870e640e7e
    • Dart version 3.0.0 (build 3.0.0-417.1.beta)
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/brettmorgan/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2022.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 70.0.5
    • Dart plugin version 222.4167.21

[✓] VS Code (version 1.77.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.4 22F5037d darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.49

[✓] Network resources
    • All expected network resources are available.

• No issues found!
@vsmenon
Copy link
Member

vsmenon commented Apr 18, 2023

@dcharkes - can you please take a quick look and assess if there is something we need to fix 3.0 stable?

@vsmenon vsmenon added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi labels Apr 18, 2023
@vsmenon vsmenon added this to the Dart 3 stable milestone Apr 18, 2023
@vsmenon
Copy link
Member

vsmenon commented Apr 18, 2023

Tentatively marking this with the Dart 3 stable milestone.

@dcharkes
Copy link
Contributor

This is tracked in

I can make the change and a pre-release with the change.
(I could push a stable release with that behavior, it would require a 3.0 stable release lower bound. So I have to do that on release day instead.)

@dcharkes
Copy link
Contributor

The PR passes on 3.0.0-417.0.dev, so nothing else needs to be fixed besides the class modifiers.

@dcharkes
Copy link
Contributor

@domesticmouse could you check that everything works out when https://pub.dev/packages/ffigen/versions/8.0.0-dev.0 instead?

@domesticmouse
Copy link
Member Author

@domesticmouse could you check that everything works out when https://pub.dev/packages/ffigen/versions/8.0.0-dev.0 instead?

Yup working as intended: flutter/codelabs#1561

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi
Projects
None yet
Development

No branches or pull requests

3 participants