Skip to content
Advertisement

Unable to compile flutter app in release mode on linux

I am running a linux app on a Debian 11 arm 64 in debug mode and everything is fine, please see the logs in my github issue because it was too long for SO.

When i try to run it in release or profile mode, the flutter tool doesn’t seem able to compile :

[  +38 ms] 💪 Building with sound null safety 💪
[   +7 ms] Building Linux application...
[   +7 ms] executing: [build/linux/arm64/release/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DFLUTTER_TARGET_PLATFORM=linux-arm64 /home/user1/test_app/linux
[  +49 ms] -- Configuring done
[  +11 ms] -- Generating done
[   +9 ms] -- Build files have been written to: /home/user1/test_app/build/linux/arm64/release
[   +2 ms] executing: ninja -C build/linux/arm64/release install
[   +5 ms] ninja: Entering directory `build/linux/arm64/release'
[+35648 ms] [1/6] Generating /home/user1/test_app/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h, /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h, /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_call.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h, /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_response.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h, /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_view.h, /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[  +71 ms] FAILED: /home/user1/test_app/linux/flutter/ephemeral/libflutter_linux_gtk.so
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_engine.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_call.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_response.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_value.h
/home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_view.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/flutter_linux.h
flutter/_phony_
[   +4 ms] cd /home/user1/test_app/build/linux/arm64/release/flutter && /usr/bin/cmake -E env FLUTTER_ROOT=/home/user1/flutter
PROJECT_DIR=/home/user1/test_app DART_OBFUSCATION=false TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=true
PACKAGE_CONFIG=/home/user1/test_app/.dart_tool/package_config.json FLUTTER_TARGET=lib/main.dart /home/user1/flutter/packages/flutter_tools/bin/tool_backend.sh
linux-arm64 Release
[   +2 ms] [  +26 ms] executing: uname -m
[        ] [  +17 ms] Exit code 0 from: uname -m
[        ] [        ] aarch64
[        ] [   +2 ms] executing: [/home/user1/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [   +2 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] f1875d570e39de09040c8f79aa13cc56baab8db1
[        ] [        ] executing: [/home/user1/flutter/] git tag --points-at f1875d570e39de09040c8f79aa13cc56baab8db1
[        ] [   +7 ms] Exit code 0 from: git tag --points-at f1875d570e39de09040c8f79aa13cc56baab8db1
[        ] [        ] 3.0.5
[        ] [   +3 ms] executing: [/home/user1/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[        ] [   +1 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/user1/flutter/] git ls-remote --get-url origin
[        ] [   +1 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +21 ms] Unable to locate an Android SDK.
[        ] [   +1 ms] executing: [/home/user1/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +1 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +24 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.
[        ] [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' 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.
[        ] [  +54 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.
[        ] [        ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' 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.
[        ] [        ] 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.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +22 ms] Initializing file store
[        ] [   +2 ms] Done initializing file store
[        ] [  +16 ms] Skipping target: gen_localizations
[        ] [   +7 ms] Skipping target: gen_dart_plugin_registrant
[        ] [ +164 ms] Skipping target: unpack_linux
[        ] [        ] kernel_snapshot: Starting due to {}
[   +1 ms] [   +7 ms] /home/user1/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/user1/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root
/home/user1/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product/ --target=flutter --no-print-incremental-dependencies -Ddart.vm.profile=false
-Ddart.vm.product=true --aot --tfa --packages /home/user1/test_app/.dart_tool/package_config.json --output-dill
/home/user1/test_app/.dart_tool/flutter_build/ec49c54613fec883357bbf42c3bdb324/app.dill --depfile
/home/user1/test_app/.dart_tool/flutter_build/ec49c54613fec883357bbf42c3bdb324/kernel_snapshot.d --source
/home/user1/test_app/.dart_tool/flutter_build/dart_plugin_registrant.dart --source package:flutter/src/dart_plugin_registrant.dart
-Dflutter.dart_plugin_registrant=file:///home/user1/test_app/.dart_tool/flutter_build/dart_plugin_registrant.dart package:test_app/main.dart
[   +8 ms] [+33967 ms] Persisting file store
[        ] [  +44 ms] Done persisting file store
[        ] [  +23 ms] Target kernel_snapshot failed: Exception
[        ]            #0      KernelSnapshot.build (package:flutter_tools/src/build_system/targets/common.dart:241:7)
[        ]            <asynchronous suspension>
[        ]            #1      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:839:9)
[        ]            <asynchronous suspension>
[        ]            #2      Future.wait.<anonymous closure> (dart:async/future.dart:521:21)
[        ]            <asynchronous suspension>
[   +4 ms]            #3      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:777:32)
[        ]            <asynchronous suspension>
[        ]            #4      Future.wait.<anonymous closure> (dart:async/future.dart:521:21)
[        ]            <asynchronous suspension>
[        ]            #5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:777:32)
[        ]            <asynchronous suspension>
[        ]            #6      Future.wait.<anonymous closure> (dart:async/future.dart:521:21)
[        ]            <asynchronous suspension>
[        ]            #7      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:777:32)
[        ]            <asynchronous suspension>
[        ]            #8      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:606:16)
[        ]            <asynchronous suspension>
[        ]            #9      AssembleCommand.runCommand (package:flutter_tools/src/commands/assemble.dart:320:32)
[        ]            <asynchronous suspension>
[        ]            #10     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
[        ]            <asynchronous suspension>
[        ]            #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #12     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
[        ]            <asynchronous suspension>
[        ]            #13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
[        ]            <asynchronous suspension>
[        ]            #14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #15     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
[        ]            <asynchronous suspension>
[        ]            #16     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
[        ]            <asynchronous suspension>
[        ]            #17     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
[        ]            <asynchronous suspension>
[        ]            #18     main (package:flutter_tools/executable.dart:94:3)
[        ]            <asynchronous suspension>
[  +14 ms] [  +53 ms] "flutter assemble" took 34 338ms.
[   +2 ms] [  +35 ms] 
[        ]            #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
[        ]            #1      AssembleCommand.runCommand (package:flutter_tools/src/commands/assemble.dart:337:7)
[        ]            <asynchronous suspension>
[        ]            #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183: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:94:3)
[        ]            <asynchronous suspension>
[        ] [ +238 ms] ensureAnalyticsSent: 233ms
[        ] [   +5 ms] Running shutdown hooks
[        ] [   +1 ms] Shutdown hooks complete
[        ] [   +1 ms] exiting with code 1
[        ] ninja: build stopped: subcommand failed.
[  +65 ms] Building Linux application... (completed in 35,9s)
[   +7 ms] "flutter linux" took 36 359ms.
[  +42 ms] Build process failed
[   +7 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _runBuild (package:flutter_tools/src/linux/build_linux.dart:186:5)
           <asynchronous suspension>
           #2      buildLinux (package:flutter_tools/src/linux/build_linux.dart:78:5)
           <asynchronous suspension>
           #3      BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:85:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>
          
[ +268 ms] ensureAnalyticsSent: 257ms
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

It seems to be thrown with Target kernel_snapshot failed: Exception but i have no other error logs so i can’t know what is actually failing…

Edit : The issue comes from something ran by ninja :

user1@debian11arm64v2:~/test_app/build/linux/arm64$ ninja -C build/linux/arm64/release install
ninja: Entering directory `build/linux/arm64/release/'
[1/6] Generating /home/user1/test_app/linux/flutter/ephemeral/libflutter_li...ele/test_app/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
FAILED: /home/user1/test_app/linux/flutter/ephemeral/libflutter_linux_gtk.so /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_engine.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_call.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_method_response.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_value.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/fl_view.h /home/user1/test_app/linux/flutter/ephemeral/flutter_linux/flutter_linux.h flutter/_phony_ 
cd /home/user1/test_app/build/linux/arm64/release/flutter && /usr/bin/cmake -E env FLUTTER_ROOT=/home/user1/flutter PROJECT_DIR=/home/user1/test_app DART_OBFUSCATION=false TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=false PACKAGE_CONFIG=/home/user1/test_app/.dart_tool/package_config.json FLUTTER_TARGET=lib/main.dart /home/user1/flutter/packages/flutter_tools/bin/tool_backend.sh linux-arm64 Release

ninja: build stopped: subcommand failed.

Advertisement

Answer

I have found the solution, i had to increase my RAM to 4Go on my Debian 11 from 1Go.

I had not enough memory to be able to compile in release mode.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement