Skip to content

Add basic desktop linux checks - #31873

Merged
jonahwilliams merged 13 commits into
flutter:masterfrom
jonahwilliams:desktop_doctor
Jun 19, 2019
Merged

jonahwilliams merged 13 commits into
flutter:masterfrom
jonahwilliams:desktop_doctor

Conversation

@jonahwilliams

@jonahwilliams jonahwilliams commented Apr 30, 2019 •

Copy link
Copy Markdown
Contributor

Description

Adds doctor validation checks for gcc and gtk for linux desktop:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.5.9-pre.62, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Linux toolchain - develop for Linux desktop applications
[!] Android Studio (version 3.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Ultimate Edition (version 2018.2)
[!] IntelliJ IDEA Ultimate Edition (version 2018.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
[!] VS Code (version 1.27.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)

With -v

[✓] Linux toolchain - develop for Linux desktop applications
    • clang++ 4.0.1
    • GNU Make 4.1

#31368

final List<ValidationMessage> messages = <ValidationMessage>[];
/// Check for some version of GCC.
final ProcessResult gccResult = await processManager.run(const <String>[
'g++',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The choice of GCC vs clang is specific to the FDE example (and might be something we want to change before templatizing); it doesn't seem like we should have doctor check for things that aren't required by flutter_tool.

How about checking for make, since that's what the tooling actually expects at this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doctor could check make and then for both clang/gcc as a hint? Longer term, I would like to break out each doctor validation check to make it platform/template specific (see go/flutter-tool-extensions).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar yet with the gradations of checks that the doctor support, but an error for not having make and a warning for not having gcc or clang definitely seems reasonable as a starting point. (Substituting whatever the right terminology is here for 'error' and 'warning')


/// Check for the correct version of gtk.
final ProcessResult gtkResult = await processManager.run(const <String>[
'pkg-config',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd need to make sure pkg-config was present first. But as with GCC, I don't think we should actually be requiring that. The shell does have a runtime dependency on GTK, but that could be satisfied without pkg-config being present.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need not be required, but it could be a hint. Is there a better method to detect whether gtk is there at runtime?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, when I say it's a runtime dependency I mean that end users of the built application need GTK; it's not a developer-specific thing. That's why I don't think doctor should check for it.

Is there a better method to detect whether gtk is there

It's Linux, so as always the answer seems to be "it depends on your distribution!"

Honestly I think that without a bunch of fallback logic and iteration with different distros we're likely to create a lot of false-positives (i.e., whatever we use to check of the presence of GTK is going to be missing more often than GTK), and that we're better off not doing this for now, and seeing if there's really a need for a GTK check in practice based on feedback.

@goderbauer goderbauer added the tool Affects the "flutter" command-line tool. See also t: labels. label May 1, 2019

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I totally forget about this PR :(

final List<ValidationMessage> messages = <ValidationMessage>[];
/// Check for some version of GCC.
final ProcessResult gccResult = await processManager.run(const <String>[
'g++',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar yet with the gradations of checks that the doctor support, but an error for not having make and a warning for not having gcc or clang definitely seems reasonable as a starting point. (Substituting whatever the right terminology is here for 'error' and 'warning')


/// Check for the correct version of gtk.
final ProcessResult gtkResult = await processManager.run(const <String>[
'pkg-config',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, when I say it's a runtime dependency I mean that end users of the built application need GTK; it's not a developer-specific thing. That's why I don't think doctor should check for it.

Is there a better method to detect whether gtk is there

It's Linux, so as always the answer seems to be "it depends on your distribution!"

Honestly I think that without a bunch of fallback logic and iteration with different distros we're likely to create a lot of false-positives (i.e., whatever we use to check of the presence of GTK is going to be missing more often than GTK), and that we're better off not doing this for now, and seeing if there's really a need for a GTK check in practice based on feedback.

@jonahwilliams

Copy link
Copy Markdown
Contributor Author

Closing this for now until I have some more time

@stuartmorgan-g

Copy link
Copy Markdown
Contributor

The template switched to Clang, which I intend to be a permanent change, so when this gets picked up again the initial version that covers everything needed for the simple example app should be:

  • check for make
  • check for clang++ (if we want to be fancy, version 3.4+, since we use C++14)

@jonahwilliams jonahwilliams reopened this Jun 17, 2019
@jonahwilliams

Copy link
Copy Markdown
Contributor Author

This is back on my radar

@jonahwilliams

Copy link
Copy Markdown
Contributor Author

Updated to check for clang++ greater than version 3.4 and make

Comment thread packages/flutter_tools/lib/src/linux/linux_doctor.dart Outdated
Comment thread packages/flutter_tools/lib/src/doctor.dart
Comment thread packages/flutter_tools/lib/src/linux/linux_doctor.dart Outdated
Comment thread packages/flutter_tools/lib/src/linux/linux_doctor.dart Outdated
Comment thread packages/flutter_tools/lib/src/linux/linux_doctor.dart Outdated
Comment thread packages/flutter_tools/lib/src/linux/linux_doctor.dart
Comment thread packages/flutter_tools/test/linux/linux_doctor_test.dart Outdated
Comment thread packages/flutter_tools/test/linux/linux_doctor_test.dart
Comment thread packages/flutter_tools/lib/src/linux/linux_doctor.dart Outdated
Comment thread packages/flutter_tools/test/linux/linux_doctor_test.dart Outdated

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more test note, but LGTM

Comment thread packages/flutter_tools/test/linux/linux_doctor_test.dart
@jonahwilliams

Copy link
Copy Markdown
Contributor Author

cc @dnfield, do you know why this change would be failing the release_smoke_tests ? I don't know how to run it locally to debug, but this should have no effect on an Android build

@dnfield

dnfield commented Jun 19, 2019

Copy link
Copy Markdown
Contributor

It looks like Gradle is failing to build in release mode with these changes.

The command that's failing is ../../../bin/flutter build appbundle --target-platform android-arm,android-arm64 from dev/integration_tests/release_smoke_test. Is that passing locally?

@jonahwilliams

Copy link
Copy Markdown
Contributor Author

Works fine locally, though I'm also on a mac

@dnfield

dnfield commented Jun 19, 2019

Copy link
Copy Markdown
Contributor

Ah. I think this is the gradle emoji bug.

Can you try replacing:

        - ./dev/bots/firebase_testlab.sh

with

        - echo "$CIRRUS_CHANGE_MESSAGE" > /tmp/cirrus_change_message.txt
        - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt
        - export CIRRUS_CHANGE_MESSAGE=""
        - export CIRRUS_COMMIT_MESSAGE=""
        - ./dev/bots/firebase_testlab.sh
        - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt`
        - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt`

in cirrus.yml?

@jonahwilliams

Copy link
Copy Markdown
Contributor Author

Didn't work, can we submit on red for this case after I roll back the cirrus config?

@jonahwilliams
jonahwilliams merged commit f221ad1 into flutter:master Jun 19, 2019
@tvolkert

Copy link
Copy Markdown
Contributor

Looks like this is causing the following bot failures:

[✓] Flutter (Channel master, v1.7.6-pre.19, on Linux, locale en_US.UTF-8)
    • Flutter version 1.7.6-pre.19 at /tmp/flutter sdk
    • Framework revision f221ad1f92 (3 minutes ago), 2019-06-19 15:51:21 -0700
    • Engine revision 54f88ab5da
    • Dart version 2.4.0
Invalid argument(s): Cannot find executable for clang++.
#0      _getExecutable (package:process/src/interface/local_process_manager.dart:113:5)
#1      LocalProcessManager.run (package:process/src/interface/local_process_manager.dart:62:7)
#2      LinuxDoctorValidator.validate (package:flutter_tools/src/linux/linux_doctor.dart:22:60)
<asynchronous suspension>
#3      Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:152:52)
#4      Doctor.diagnose (package:flutter_tools/src/doctor.dart:223:41)
#5      _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#6      Doctor.diagnose (package:flutter_tools/src/doctor.dart:213:24)
#7      DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:48:39)

jonahwilliams pushed a commit that referenced this pull request Jun 19, 2019
jonahwilliams pushed a commit that referenced this pull request Jun 19, 2019
@jonahwilliams

Copy link
Copy Markdown
Contributor Author

Not sure why CI didn't catch this - possibly some interaction between the PRs I landed today

johnsonmh pushed a commit to johnsonmh/flutter that referenced this pull request Jul 30, 2019
johnsonmh pushed a commit to johnsonmh/flutter that referenced this pull request Jul 30, 2019
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants