Repository: flutter
Issue: Build fails on Linux: `unused parameter 'self'` in `my_application.cc`
Labels: c: crash,tool,platform-linux,a: build,P3,team-tool,triaged-tool

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Create a new project from the command-line.
2. Run command `flutter run`
3. `Exception: Build process failed`

**Expected results:** <!-- what did you want to see? -->
Expected flutter to run the Linux version.

**Actual results:** <!-- what did you see? -->
Error: unused parameter in my_application.cc

<details>
  <summary>Logs</summary>

<!--
      Run your application with `flutter run --verbose` and attach all the
      log output below between the lines with the backticks. If there is an
      exception, please see if the error message includes enough information
      to explain how to solve the issue. If there is a crash, please include
      the entirety of the crash log including the backtrace.
-->
`flutter run -v`:

```
[ +125 ms] executing: uname -m
[  +67 ms] Exit code 0 from: uname -m
[        ] x86_64
[  +10 ms] executing: [/home/mhmd/flutter/] git -c log.showSignature=false log
-n 1 --pretty=format:%H
[  +17 ms] Exit code 0 from: git -c log.showSignature=false log -n 1
--pretty=format:%H
[        ] ffccd96b62ee8cec7740dab303538c5fc26ac543
[   +1 ms] executing: [/home/mhmd/flutter/] git tag --points-at
ffccd96b62ee8cec7740dab303538c5fc26ac543
[  +28 ms] Exit code 0 from: git tag --points-at
ffccd96b62ee8cec7740dab303538c5fc26ac543
[        ] 3.3.0
[ +114 ms] executing: [/home/mhmd/flutter/] git rev-parse --abbrev-ref
--symbolic @{upstream}
[  +12 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ] origin/stable
[        ] executing: [/home/mhmd/flutter/] git ls-remote --get-url origin
[   +8 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +65 ms] executing: [/home/mhmd/flutter/] git rev-parse --abbrev-ref HEAD
[   +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[ +108 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping
update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping
update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping
update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping
update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required,
skipping update.
[  +90 ms] executing: /home/mhmd/Android/Sdk/platform-tools/adb devices -l
[  +86 ms] List of devices attached
[  +11 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required,
skipping update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping
update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping
update.
[   +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping
update.
[   +3 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required,
skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required,
skipping update.
[ +132 ms] Skipping pub get: version match.
[ +282 ms] Generating
/home/mhmd/Projects/fluttest/android/app/src/main/java/io/flutter/plugins/Genera
tedPluginRegistrant.java
[ +164 ms] Initializing file store
[  +14 ms] Skipping target: gen_localizations
[  +10 ms] gen_dart_plugin_registrant: Starting due to
{InvalidatedReasonKind.inputChanged: The following inputs have updated contents:
/home/mhmd/Projects/fluttest/.dart_tool/package_config_subset}
[  +35 ms] gen_dart_plugin_registrant: Complete
[   +1 ms] Skipping target: _composite
[   +3 ms] complete
[   +8 ms] Launching lib/main.dart on Linux in debug mode...
[   +6 ms] /home/mhmd/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/mhmd/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapsho
t --sdk-root
/home/mhmd/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/
--incremental --target=flutter --debugger-module-names
--experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill
/tmp/flutter_tools.UWGRCB/flutter_tool.RKONPJ/app.dill --packages
/home/mhmd/Projects/fluttest/.dart_tool/package_config.json
-Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --filesystem-scheme org-dartlang-root
--initialize-from-dill
build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --verbosity=error
--enable-experiment=alternative-invalidation-strategy
[  +37 ms] Building Linux application...
[  +28 ms] <- compile package:fluttest/main.dart
[   +3 ms] executing: [build/linux/x64/debug/] cmake -G Ninja
-DCMAKE_BUILD_TYPE=Debug -DFLUTTER_TARGET_PLATFORM=linux-x64
/home/mhmd/Projects/fluttest/linux
[ +106 ms] -- Configuring done
[  +14 ms] -- Generating done
[  +21 ms] -- Build files have been written to:
/home/mhmd/Projects/fluttest/build/linux/x64/debug
[   +8 ms] executing: ninja -C build/linux/x64/debug install
[  +17 ms] ninja: Entering directory `build/linux/x64/debug'
[+6807 ms] [1/6] Generating
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_basic_mess
age_channel.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_binary_cod
ec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_binary_mes
senger.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_dart_proje
ct.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_json_messa
ge_codec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_json_metho
d_codec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_message_co
dec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_method_cal
l.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_method_cha
nnel.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_method_cod
ec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_method_res
ponse.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_plugin_reg
istrar.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_plugin_reg
istry.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_standard_m
essage_codec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_standard_m
ethod_codec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_string_cod
ec.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/fl_view.h,
/home/mhmd/Projects/fluttest/linux/flutter/ephemeral/flutter_linux/flutter_linux
.h, _phony_
[  +33 ms] [ +147 ms] executing: uname -m
[        ] [ +100 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [  +17 ms] executing: [/home/mhmd/flutter/] git -c
log.showSignature=false log -n 1 --pretty=format:%H
[   +7 ms] [  +13 ms] Exit code 0 from: git -c log.showSignature=false log -n 1
--pretty=format:%H
[        ] [        ] ffccd96b62ee8cec7740dab303538c5fc26ac543
[        ] [   +1 ms] executing: [/home/mhmd/flutter/] git tag --points-at
ffccd96b62ee8cec7740dab303538c5fc26ac543
[  +12 ms] [  +40 ms] Exit code 0 from: git tag --points-at
ffccd96b62ee8cec7740dab303538c5fc26ac543
[        ] [        ] 3.3.0
[        ] [ +226 ms] executing: [/home/mhmd/flutter/] git rev-parse
--abbrev-ref HEAD
[        ] [  +15 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [ +111 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is
not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required,
skipping update.
[        ] [   +7 ms] Artifact Instance of 'WindowsEngineArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not
required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not
required, skipping update.
[        ] [ +208 ms] executing: [/home/mhmd/flutter/] git rev-parse
--abbrev-ref --symbolic @{upstream}
[        ] [  +10 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic
@{upstream}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/mhmd/flutter/] git ls-remote --get-url
origin
[        ] [  +14 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [   +2 ms] Artifact Instance of 'MaterialFonts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is
not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not
required, skipping update.
[   +3 ms] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not
required, skipping update.
[        ] [   +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not
required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required,
skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required,
skipping update.
[   +1 ms] [        ] Artifact Instance of 'IosUsbArtifacts' is not required,
skipping update.
[  +13 ms] [        ] Artifact Instance of 'FontSubsetArtifacts' is not
required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'PubDependencies' is not required,
skipping update.
[   +3 ms] [ +120 ms] Initializing file store
[        ] [  +18 ms] Done initializing file store
[   +1 ms] [ +156 ms] Skipping target: gen_localizations
[        ] [  +82 ms] Skipping target: gen_dart_plugin_registrant
[        ] [+1674 ms] Skipping target: unpack_linux
[   +2 ms] [+1260 ms] Skipping target: kernel_snapshot
[        ] [ +809 ms] Skipping target: debug_bundle_linux-x64_assets
[        ] [   +2 ms] Persisting file store
[        ] [  +23 ms] Done persisting file store
[        ] [  +10 ms] build succeeded.
[   +6 ms] [  +18 ms] "flutter assemble" took 4,460ms.
[        ] [ +264 ms] ensureAnalyticsSent: 255ms
[        ] [   +1 ms] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [   +1 ms] exiting with code 0
[+2005 ms] [2/6] Building CXX object
CMakeFiles/fluttest.dir/flutter/generated_plugin_registrant.cc.o
[   +2 ms] FAILED:
CMakeFiles/fluttest.dir/flutter/generated_plugin_registrant.cc.o
[  +20 ms] /bin/clang++ -DAPPLICATION_ID=\"com.example.fluttest\"
-I/home/mhmd/Projects/fluttest/linux/flutter/ephemeral -isystem
/usr/include/gtk-3.0 -isystem /usr/include/pango-1.0 -isystem
/usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include -isystem
/usr/include/sysprof-4 -isystem /usr/include/harfbuzz -isystem
/usr/include/freetype2 -isystem /usr/include/libpng16 -isystem
/usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/fribidi
-isystem /usr/include/libxml2 -isystem /usr/include/cairo -isystem
/usr/include/pixman-1 -isystem /usr/include/gdk-pixbuf-2.0 -isystem
/usr/include/gio-unix-2.0 -isystem /usr/include/cloudproviders -isystem
/usr/include/atk-1.0 -isystem /usr/include/at-spi2-atk/2.0 -isystem
/usr/include/dbus-1.0 -isystem /usr/lib64/dbus-1.0/include -isystem
/usr/include/at-spi-2.0 -Wall -Wextra -std=c++20 -g -Wall -Werror -pthread -MD
-MT CMakeFiles/fluttest.dir/flutter/generated_plugin_registrant.cc.o -MF
CMakeFiles/fluttest.dir/flutter/generated_plugin_registrant.cc.o.d -o
CMakeFiles/fluttest.dir/flutter/generated_plugin_registrant.cc.o -c
/home/mhmd/Projects/fluttest/linux/flutter/generated_plugin_registrant.cc
[  +13 ms]
/home/mhmd/Projects/fluttest/linux/flutter/generated_plugin_registrant.cc:10:44:
error: unused parameter 'registry' [-Werror,-Wunused-parameter]
[  +17 ms] void fl_register_plugins(FlPluginRegistry* registry) {
[        ]                                            ^
[        ] 1 error generated.
[  +26 ms] [3/6] Building CXX object CMakeFiles/fluttest.dir/main.cc.o
[ +337 ms] [4/6] Building CXX object CMakeFiles/fluttest.dir/my_application.cc.o
[        ] FAILED: CMakeFiles/fluttest.dir/my_application.cc.o 
[   +5 ms] /bin/clang++ -DAPPLICATION_ID=\"com.example.fluttest\"
-I/home/mhmd/Projects/fluttest/linux/flutter/ephemeral -isystem
/usr/include/gtk-3.0 -isystem /usr/include/pango-1.0 -isystem
/usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include -isystem
/usr/include/sysprof-4 -isystem /usr/include/harfbuzz -isystem
/usr/include/freetype2 -isystem /usr/include/libpng16 -isystem
/usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/fribidi
-isystem /usr/include/libxml2 -isystem /usr/include/cairo -isystem
/usr/include/pixman-1 -isystem /usr/include/gdk-pixbuf-2.0 -isystem
/usr/include/gio-unix-2.0 -isystem /usr/include/cloudproviders -isystem
/usr/include/atk-1.0 -isystem /usr/include/at-spi2-atk/2.0 -isystem
/usr/include/dbus-1.0 -isystem /usr/lib64/dbus-1.0/include -isystem
/usr/include/at-spi-2.0 -Wall -Wextra -std=c++20 -g -Wall -Werror -pthread -MD
-MT CMakeFiles/fluttest.dir/my_application.cc.o -MF
CMakeFiles/fluttest.dir/my_application.cc.o.d -o
CMakeFiles/fluttest.dir/my_application.cc.o -c
/home/mhmd/Projects/fluttest/linux/my_application.cc
[   +4 ms] /home/mhmd/Projects/fluttest/linux/my_application.cc:97:48: error:
unused parameter 'self' [-Werror,-Wunused-parameter]
[   +1 ms] static void my_application_init(MyApplication* self) {}
[        ]                                                ^
[        ] 1 error generated.
[        ] ninja: build stopped: subcommand failed.
[  +31 ms] Building Linux application... (completed in 9.6s)
[+11384 ms] Exception: Build process failed
[  +10 ms] "flutter run" took 21,943ms.
[  +12 ms] 
           #0      throwToolExit
(package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand
           (package:flutter_tools/src/commands/run.dart:713:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure>
           (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand
(package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure>
           (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand
           (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure>
           (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure>
           (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>
           
           
[ +255 ms] ensureAnalyticsSent: 251ms
[   +2 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
```

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

`flutter analyzer`:
```
Analyzing fluttest...                                                   
No issues found! (ran in 19.4s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

I don't use Android Studio.
```
[✓] Flutter (Channel stable, 3.3.0, on Fedora Linux 36 (Workstation Edition)
    5.19.4-200.fc36.x86_64, locale en_US.UTF-8)
    • Flutter version 3.3.0 on channel stable at /home/mhmd/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffccd96b62 (3 days ago), 2022-08-29 17:28:57 -0700
    • Engine revision 5e9e0e0aa8
    • Dart version 2.18.0
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version
    32.1.0-rc1)
    • Android SDK at /home/mhmd/Android/Sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • ANDROID_SDK_ROOT = /home/mhmd/Android/Sdk
    • Java binary at: /bin/java
    • Java version OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36)
      (build 17.0.4+8)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at
    google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 14.0.5 (Fedora 14.0.5-1.fc36)
    • cmake version 3.22.2
    • ninja version 1.10.2
    • pkg-config version 1.8.0

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup
      for detailed instructions).

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Fedora Linux 36 (Workstation
      Edition) 5.19.4-200.fc36.x86_64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
```

</details>