Unable to build flutter application for linux
Description
It seems it's not possible to build flutter application for linux
Steps To Reproduce
$ flutter build linux
/home/roland/entwicklung/wger/flutter/linux/flutter/ephemeral/.plugin_symlinks/rive_common/macos/SheenBidi/Source/SBParagraph.c:618:16: error: unused variable 'stringLength' [-Werror,-Wunused-variable]
Building Linux application...
Build process failed
Source .riv/.rev file
n/a
Expected behavior
The build succeds. It seems that 0.13.0 is the version that introduced the bug, it's possible to build the application with 0.12.4 without any problems.
Screenshots
n/a
Device & Versions (please complete the following information)
- Device: linux
- OS: Ubuntu 22.04
- Flutter Version:
Flutter 3.19.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 54e66469a9 (vor 4 Wochen) • 2024-04-17 13:08:03 -0700
Engine • revision c4cd48e186
Tools • Dart 3.3.4 • DevTools 2.31.1
Additional context
Also happens on github's CI: https://github.com/wger-project/flutter/actions/runs/9052280531/job/24869782253
Got the same error: https://ci.appveyor.com/project/flet-dev/flet/build/job/8ml3csb67k1mi5dr#L1994
0.13.2 introduced that issue. 0.13.1 gives successful build: https://ci.appveyor.com/project/flet-dev/flet/builds/49860784/job/ctoa28981dcvrgg5#L1926
0.13.2 adds rive_common native plugin: https://github.com/flet-dev/flet/commit/40030648ff9de15c80dfe83990aeb729cfd80c25#diff-b944988673a542aa817aea9d0faaa93591b3acab9f6b5ca62be94d0b951c8989
Same error with 0.13.1 and latest 0.13.5 on Linux Mint. Build is OK with 0.12.4 thanks rolandgeider
/home/cdesbois/Documents/flutter_app/SP/linux/flutter/ephemeral/.plugin_symlinks/rive_common/macos/SheenBidi/Source/SBParagraph.c:619:16: error: unused variable 'stringLength' [-Werror,-Wunused-variable]
flutter --version
Flutter 3.22.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5dcb86f68f (il y a 3 semaines) • 2024-05-09 07:39:20 -0500
Engine • revision f6344b75dc
Tools • Dart 3.4.0 • DevTools 2.34.3
This should be higher priority issue. Almost 2 months but no fix is applied for an unused variable warning causing build error. Please update it with a fix.
Is there any update? It's still impossible to build the app for Linux with the latest Rive.
As a data point I build Rive 0.4.11 (added CMake) for Yocto Linux using this repo: https://github.com/meta-flutter/rive-common/
The install target also installs a package config file.
This Yocto recipe supports both GCC 13 and Clang 18: https://github.com/meta-flutter/meta-flutter/blob/scarthgap/recipes-graphics/rive/rive-text_0.4.11.bb
Same issue, please fix this bug.
You can get around this by adding -Wno-unused-variable and -Wno-unused-function flags after the existing -Werror flags on this line of your CMakeLists.txt file in the linux directory.
target_compile_options(${TARGET} PRIVATE -Wall -Werror -Wno-unused-variable -Wno-unused-function)
Those flags are already in the clang build command for rive and the SheenBidi dependency...I don't know why I have to add the flags to my global flutter linux config in order to make things work.
Running with flutter build linux -v shows the particular clang command causing the error. Maybe someone has insight as to why it still throws the error despite those two -Wno flags already being included.
[ +52 ms] [2/7] Building C object plugins/rive_common/CMakeFiles/rive_common_plugin.dir/__/macos/SheenBidi/Source/SheenBidi.c.o
[ ] FAILED: plugins/rive_common/CMakeFiles/rive_common_plugin.dir/__/macos/SheenBidi/Source/SheenBidi.c.o
[ +6 ms] /usr/bin/clang -DAPPLICATION_ID=\"com.example.example\" -DFLUTTER_PLUGIN_IMPL -DNDEBUG -Drive_common_plugin_EXPORTS
-I/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/linux/../macos/harfbuzz/src
-I/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/linux/../macos/rive-cpp/skia/renderer/include
-I/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/linux/../macos/rive-cpp/include
-I/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/linux/../macos/SheenBidi/Headers
-I/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/linux/../macos/miniaudio
-I/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/linux/../macos/yoga
-I/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral -isystem /usr/include/gtk-3.0 -isystem /usr/include/pango-1.0 -isystem /usr/include/glib-2.0
-isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -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/cairo -isystem /usr/include/pixman-1 -isystem
/usr/include/gdk-pixbuf-2.0 -isystem /usr/include/webp -isystem /usr/include/gio-unix-2.0 -isystem /usr/include/atk-1.0 -isystem /usr/include/at-spi2-atk/2.0
-isystem /usr/include/at-spi-2.0 -isystem /usr/include/dbus-1.0 -isystem /usr/lib/x86_64-linux-gnu/dbus-1.0/include -DYOGA_EXPORT= -DSB_CONFIG_UNITY
-DWITH_RIVE_TEXT -DWITH_RIVE_AUDIO_TOOLS -DWITH_RIVE_AUDIO -DMA_NO_RESOURCE_MANAGER -DHAVE_OT -DHB_NO_FALLBACK_SHAPE -DHB_NO_WIN1256 -DHB_NO_CFF
-DHB_NO_BUFFER_VERIFY -DHB_NO_BUFFER_MESSAGE -DHB_NO_PAINT -DHB_NO_MMAP -DHB_NO_META -Wno-documentation -Wno-comma -Wno-unreachable-code -Wno-shorten-64-to-32
-ansi -pedantic -Wno-unused-function -Wno-unused-variable -DANSI_DECLARATORS -O3 -DNDEBUG -fPIC -Wall -Werror -O3 -pthread -MD -MT
plugins/rive_common/CMakeFiles/rive_common_plugin.dir/__/macos/SheenBidi/Source/SheenBidi.c.o -MF
plugins/rive_common/CMakeFiles/rive_common_plugin.dir/__/macos/SheenBidi/Source/SheenBidi.c.o.d -o
plugins/rive_common/CMakeFiles/rive_common_plugin.dir/__/macos/SheenBidi/Source/SheenBidi.c.o -c
/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/macos/SheenBidi/Source/SheenBidi.c
[ +2 ms] In file included from
/home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/macos/SheenBidi/Source/SheenBidi.c:36:
[ ] /home/caseymdk/tmp/rive-flutter/example/linux/flutter/ephemeral/.plugin_symlinks/rive_common/macos/SheenBidi/Source/SBParagraph.c:618:16: error:
unused variable 'stringLength' [-Werror,-Wunused-variable]
[ +1 ms] 618 | SBUInteger stringLength = codepointSequence->stringLength;
[ ] | ^~~~~~~~~~~~
[ ] 1 error generated.
I got an error, flet version 0.25.2 package:proyect_main/main.dart
[ ] [+2528 ms]
../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:356:2
8: Error: A value of type 'TabBarThemeData' can't be returned from a function
with return type 'TabBarTheme?'.
[ ] [ ] - 'TabBarThemeData' is from
'package:flutter/src/material/tab_bar_theme.dart'
('/usr/bin/flutter/packages/flutter/lib/src/material/tab_bar_theme.dart').
[ ] [ ] - 'TabBarTheme' is from
'package:flutter/src/material/tab_bar_theme.dart'
('/usr/bin/flutter/packages/flutter/lib/src/material/tab_bar_theme.dart').
[ ] [ ] return theme.tabBarTheme.copyWith(
[ ] [ ] ^
[ ] [ ]
../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:438:2
8: Error: A value of type 'DialogThemeData' can't be returned from a function
with return type 'DialogTheme?'.
[ ] [ ] - 'DialogThemeData' is from
'package:flutter/src/material/dialog_theme.dart'
('/usr/bin/flutter/packages/flutter/lib/src/material/dialog_theme.dart').
[ ] [ ] - 'DialogTheme' is from
'package:flutter/src/material/dialog_theme.dart'
('/usr/bin/flutter/packages/flutter/lib/src/material/dialog_theme.dart').
[ ] [ ] return theme.dialogTheme.copyWith(
[ ] [ ] ^
[ ] [ ]
../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:482:2
6: Error: A value of type 'CardThemeData' can't be returned from a function with
return type 'CardTheme?'.
[ ] [ ] - 'CardThemeData' is from
'package:flutter/src/material/card_theme.dart'
('/usr/bin/flutter/packages/flutter/lib/src/material/card_theme.dart').
[ ] [ ] - 'CardTheme' is from
'package:flutter/src/material/card_theme.dart'
('/usr/bin/flutter/packages/flutter/lib/src/material/card_theme.dart').
[ ] [ ] return theme.cardTheme.copyWith(
[ ] [ ] ^
[ ] [+4789 ms] Persisting file store
[ ] [ +9 ms] Done persisting file store
[ ] [ +1 ms] Target kernel_snapshot_program failed: Exception
[ ] #0 KernelSnapshotProgram.build
(package:flutter_tools/src/build_system/targets/common.dart:274:7)
[ ]
Same issue here, 0.13.20 has same issue, cannot build on linux, I'm trying to build with 0.12.4, it's removing rive_common and it can be build successfully. Please fix this issue ASAP
We've changed how Rive Flutter works from version 0.14.0 and up. The latest dev release supports Linux. We also now pre-build the libraries (while still giving you the option to build them yourself). This issue should be resolved. If you still have Linux-related issues, please open a new ticket. Note that the Rive Renderer support for Linux is tracked in this issue: https://github.com/rive-app/rive-flutter/issues/505
You can read more here: