leanflutter / tray_manager

This plugin allows Flutter desktop apps to defines system tray.
https://pub.dev/packages/tray_manager
MIT License
230 stars 36 forks source link

On Linux Mint 21 and Ubuntu 22.04 unable to build using libayatana library. undefined reference to `g_time_zone_new_identifier' #28

Closed pc-magas closed 1 year ago

pc-magas commented 1 year ago

Once I build my minimalistic demo:

import 'dart:io' as io;
import 'package:flutter/material.dart' hide MenuItem;
import 'package:tray_manager/tray_manager.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with TrayListener {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  void initState() {
    trayManager.addListener(this);
    _init();
    super.initState();
  }

  @override
  void dispose() {
    trayManager.removeListener(this);
    super.dispose();
  }

  void _init() async {
    // Add this line to override the default close handler
    initSystemTray();
    setState(() {});
  }

  @override
  void onTrayIconMouseDown() {
    // do something, for example pop up the menu
    trayManager.popUpContextMenu();
  }

  @override
  void onTrayIconRightMouseDown() {
    // do something
  }

  @override
  void onTrayIconRightMouseUp() {
    // do something
  }

  @override
  void onTrayMenuItemClick(MenuItem menuItem) {
    if (menuItem.key == 'exitr') {
      io.exit(0);
    }
  }

  void initSystemTray() async {
    List<MenuItem> items = [
      MenuItem.separator(),
      MenuItem(
        key: 'exit',
        label: 'Exit',
      ),
    ];
    await trayManager.setContextMenu(Menu(items: items));
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Invoke "debug painting" (press "p" in the console, choose the
          // "Toggle Debug Paint" action from the Flutter Inspector in Android
          // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
          // to see the wireframe for each widget.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Via running:

flutter run -v

I get the following error:

$ flutter run -v
2022/11/09 13:09:21.033776 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse /etc/fstab: expected between 3 and 6 fields, found 8
[  +66 ms] executing: uname -m
[  +31 ms] Exit code 0 from: uname -m
[        ] x86_64
[   +6 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +10 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git tag --points-at
e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[  +15 ms] Exit code 0 from: git tag --points-at e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] 3.3.7
[  +46 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{upstream}
[   +5 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ] origin/stable
[        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git ls-remote --get-url origin
[   +6 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +37 ms] Unable to locate an Android SDK.
[   +4 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +59 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.
[   +3 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.
[  +69 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 '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.
[ +198 ms] Skipping pub get: version match.
[  +39 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[ +751 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[  +31 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[  +57 ms] Generating
/mnt/job/Kwdikas/indicator_minimnal/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +300 ms] Initializing file store
[  +10 ms] Skipping target: gen_localizations
[   +4 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have
updated contents: /mnt/job/Kwdikas/indicator_minimnal/.dart_tool/package_config_subset}
[  +17 ms] Found plugin tray_manager at
/home/pcmagas/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/tray_manager-0.2.0/
[   +5 ms] gen_dart_plugin_registrant: Complete
[        ] Skipping target: _composite
[   +2 ms] complete
[   +4 ms] Launching lib/main.dart on Linux in debug mode...
[   +3 ms] /home/pcmagas/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/pcmagas/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root
/home/pcmagas/snap/flutter/common/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.PKZNQH/flutter_tool.NTZXNO/app.dill --packages
/mnt/job/Kwdikas/indicator_minimnal/.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
[  +24 ms] Building Linux application...
[  +24 ms] <- compile package:indicator_minimnal/main.dart
[   +2 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug
-DFLUTTER_TARGET_PLATFORM=linux-x64 /mnt/job/Kwdikas/indicator_minimnal/linux
[  +58 ms] -- Configuring done
[  +18 ms] -- Generating done
[ +241 ms] -- Build files have been written to: /mnt/job/Kwdikas/indicator_minimnal/build/linux/x64/debug
[   +6 ms] executing: ninja -C build/linux/x64/debug install
[   +9 ms] ninja: Entering directory `build/linux/x64/debug'
[+3895 ms] [1/7] Generating /mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/libflutter_linux_gtk.so,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_engine.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_call.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_method_response.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/fl_view.h,
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[  +13 ms] [  +74 ms] executing: uname -m
[   +2 ms] [  +38 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [   +6 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[        ] [   +6 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [        ] e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] [        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git tag --points-at
e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] [  +16 ms] Exit code 0 from: git tag --points-at e99c9c7cd9f6c0b2f8ae6e3ebfd585239f5568f4
[        ] [        ] 3.3.7
[        ] [ +104 ms] Unable to locate an Android SDK.
[        ] [   +5 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[        ] [   +7 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +62 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.
[        ] [   +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[   +3 ms] [        ] 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.
[        ] [  +99 ms] executing: [/home/pcmagas/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic
@{upstream}
[        ] [   +6 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ] [        ] origin/stable
[        ] [        ] executing: [/home/pcmagas/snap/flutter/common/flutter/] git ls-remote --get-url origin
[        ] [   +5 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [   +1 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.
[   +2 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.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [   +1 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.
[        ] [        ] 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.
[        ] [  +41 ms] Initializing file store
[        ] [   +7 ms] Done initializing file store
[        ] [  +42 ms] Skipping target: gen_localizations
[        ] [  +20 ms] Skipping target: gen_dart_plugin_registrant
[   +2 ms] [ +657 ms] Skipping target: unpack_linux
[        ] [ +471 ms] Skipping target: kernel_snapshot
[   +1 ms] [ +299 ms] Skipping target: debug_bundle_linux-x64_assets
[        ] [        ] Persisting file store
[        ] [   +9 ms] Done persisting file store
[        ] [   +5 ms] build succeeded.
[        ] [   +9 ms] "flutter assemble" took 1.706ms.
[        ] [ +242 ms] ensureAnalyticsSent: 238ms
[        ] [        ] Running shutdown hooks
[        ] [        ] Shutdown hooks complete
[        ] [   +2 ms] exiting with code 0
[ +502 ms] [2/5] Building CXX object CMakeFiles/indicator_minimnal.dir/flutter/generated_plugin_registrant.cc.o
[  +72 ms] [3/5] Building CXX object CMakeFiles/indicator_minimnal.dir/my_application.cc.o
[ +201 ms] [4/5] Linking CXX executable intermediates_do_not_run/indicator_minimnal
[        ] FAILED: intermediates_do_not_run/indicator_minimnal 
[   +9 ms] : && /snap/flutter/current/usr/bin/clang++  -g  -B/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9
-B/snap/flutter/current/usr/lib/x86_64-linux-gnu -B/snap/flutter/current/lib/x86_64-linux-gnu
-B/snap/flutter/current/usr/lib/ -L/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9
-L/snap/flutter/current/usr/lib/x86_64-linux-gnu -L/snap/flutter/current/lib/x86_64-linux-gnu
-L/snap/flutter/current/usr/lib/ -lblkid -lgcrypt -llzma -llz4 -lgpg-error -luuid -lpthread -ldl -lepoxy
-B/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9 -B/snap/flutter/current/usr/lib/x86_64-linux-gnu
-B/snap/flutter/current/lib/x86_64-linux-gnu -B/snap/flutter/current/usr/lib/
-L/snap/flutter/current/usr/lib/gcc/x86_64-linux-gnu/9 -L/snap/flutter/current/usr/lib/x86_64-linux-gnu
-L/snap/flutter/current/lib/x86_64-linux-gnu -L/snap/flutter/current/usr/lib/ -lblkid -lgcrypt -llzma -llz4
-lgpg-error -luuid -lpthread -ldl -lepoxy CMakeFiles/indicator_minimnal.dir/main.cc.o
CMakeFiles/indicator_minimnal.dir/my_application.cc.o
CMakeFiles/indicator_minimnal.dir/flutter/generated_plugin_registrant.cc.o  -o
intermediates_do_not_run/indicator_minimnal
-Wl,-rpath,/mnt/job/Kwdikas/indicator_minimnal/build/linux/x64/debug/plugins/tray_manager:/mnt/job/Kwdikas/indicator_
minimnal/linux/flutter/ephemeral:  plugins/tray_manager/libtray_manager_plugin.so
/mnt/job/Kwdikas/indicator_minimnal/linux/flutter/ephemeral/libflutter_linux_gtk.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgtk-3.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgdk-3.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libpango-1.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libharfbuzz.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libatk-1.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libcairo-gobject.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libcairo.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgio-2.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libgobject-2.0.so
/snap/flutter/current/usr/lib/x86_64-linux-gnu/libglib-2.0.so && :
[   +2 ms] /snap/flutter/current/usr/bin/ld: /lib/x86_64-linux-gnu/libayatana-ido3-0.4.so.0: undefined reference to
`g_time_zone_new_identifier'
[        ] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[   +1 ms] ninja: build stopped: subcommand failed.
[  +12 ms] Building Linux application... (completed in 5,1s)
[+3842 ms] Exception: Build process failed
[   +3 ms] "flutter run" took 10.498ms.
[   +3 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>

[  +71 ms] ensureAnalyticsSent: 70ms
[        ] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

The major issue that I have is:

[   +2 ms] /snap/flutter/current/usr/bin/ld: /lib/x86_64-linux-gnu/libayatana-ido3-0.4.so.0: undefined reference to
`g_time_zone_new_identifier'

I am using Linux mint 21 with libayatana-appindicator3-dev as you mention on documentation. The package comes from jammy 22.04 ubuntu that repo though:

$ apt-cache madison libayatana-appindicator3-dev
libayatana-appindicator3-dev | 0.5.90-7ubuntu2 | http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Meaning that I am unable to run the application that uses this package under ubuntu 22.04 and derivative distros. Is there an alternative approach on how I can build and run my flutter application (for development) under ubuntu 22.04?

The ubuntu 22.04 is the latest LTS version hence it may cause many problems in the future for linux app development.

The flutter version I use is the 3.3.7 one:

Flutter 3.3.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision e99c9c7cd9 (7 days ago) • 2022-11-01 16:59:00 -0700
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0

With:

  tray_manager: ^0.2.0

At pubspec.yml.

pc-magas commented 1 year ago

As far as I understood the snap installed flutter fails to build due to version mismatch with GLib (snap come their their own set of libraries and do not use system's one). In order to be able to build in a later flutter versions you need to manually install the flutter without using snap.

Then install the:

sudo apt-get install libayatana-appindicator3-dev

My approach to install flutter was to use the git version:

Step 1: Place the flutter to a bin folder

mkdir -p `~/.bin/`
cd ~/.bin
git clone https://github.com/flutter/flutter.git -b stable

(An alternative approach keeping the Linux spirit is /opt folder as well. In my case I opted out though)

Then update the $PATH environmental variable via placing into the ~/.bashrc the following line:

export PATH="$PATH:/home/pcmagas/.bin/flutter/bin"

And updated the bash session (Alternatively close and open the terminal):

source ~/.bashrc

Then I installed the nessesary packages:

sudo apt-get install cmake build-essential ninja-build
sudo apt-get install libayatana-appindicator3-dev
pc-magas commented 1 year ago

I think it is good idea to b mentioned in documentation.