Dart-Code: Unable to build Linux desktop apps when VS Code is installed via Flatpak

Describe the bug

I created the test application which counts the number of times you press a button, using the VSCode flutter extension. Then I pressed F5 to build and run the project and get this error

CMake Error at CMakeLists.txt:3 (project):
  The CMAKE_CXX_COMPILER:

    /usr/bin/clang++  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

Exception: Unable to generate build files

Yet if I go to the project folder in a bash shell and type flutter run -d linux

I get this output and the project runs fine.

Launching lib/main.dart on Linux in debug mode...
Building Linux application...                                           
Syncing files to device Linux...                                   100ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪
An Observatory debugger and profiler on Linux is available at: http://127.0.0.1:38865/EcLD24T3ZEI=/
The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:38865/EcLD24T3ZEI=/

To Reproduce

Steps to reproduce the behavior:

To get the VSCode build error

  1. press <CTRL> + <SHIFT> + <P> to bring up the VSCode task runner
  2. select Flutter: New Project
  3. select a project folder
  4. give an application name
  5. press F5

Then to get the successful run in bash

  1. open bash terminal external to VSCode
  2. change working folder to the flutter test project folder
  3. execute flutter run -d linux

Expected behavior A clear and concise description of what you expected to happen.

I expect the test application to build and run in VSCode just as it does in the bash shell.

Screenshots If applicable, add screenshots to help explain your problem.

Please complete the following information:

  • Operating System and version: Kubuntu 22.10
  • VS Code version: 1.74.1
  • Dart extension version: Dart SDK version: 2.18.6 (stable)
  • Dart/Flutter SDK version: 3.3.10 • channel stable • https://github.com/flutter/flutter.git
  • Target device (if the issue relates to Flutter debugging): linux

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Great, glad you’ve up and running! I’ll update the title, and hopefully will remember this in future. Perhaps it’s also worth detecting this from the VS Code extension and recording it in the log somewhere (or finding a way to surface it to the user if things seem to be failing). I’ll make a note to think more about this (since a similar issue exists with Snap).