Closed xobs closed 3 years ago
Part of this could be due to me using this dunfell
release on gatesgarth
, but I don't believe that's the case.
What happens if you remove 'touch ~/.pub-cache', and just have 'rm -rf ~/.pub-cache' prior to build?
If I remove ~/.pub-cache
the build continues but fails at the final packaging QA step because there are undeclared files -- namely /usr/share/flutter/sdl/.git/*
and /usr/share/flutter/sdk/.github/*
, which is a separate issue.
Looks like PUB_CACHE defaults to '~/.pub-cache' and can be overridden. Maybe point it to '${S}/.pub-cache' and see what happens
This works fine for me (git pull meta-flutter)
repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-gatesgarth -m imx-5.10.9-1.0.0.xml
repo sync -j48
DISTRO=fslc-wayland MACHINE=imx8qxpmek source setup-environment build
pushd ../sources
git clone -b dunfell https://github.com/jwinarske/meta-flutter.git
popd
bitbake-layers add-layer ../sources/meta-clang ../sources/meta-flutter
echo -e 'TARGET_GCC_VERSION = "10.2.0"' >> conf/local.conf
echo -e 'FLUTTER_CHANNEL = "dev"' >> conf/local.conf
echo -e 'IMAGE_INSTALL_append = " flutter-wayland"' >> conf/local.conf
echo -e 'IMAGE_INSTALL_append = " flutter-gallery"' >> conf/local.conf
bitbake flutter-sdk-native
Are you doing "bitbake flutter-sdk"?
I have no use case for supporting flutter application development on target, host side development with hot reload makes more sense. I will be updating flutter-sdk and depot-tools to be native only to avoid this confusion.
Thanks, I can confirm that things are working on my end as well. Furthermore, flutter-engine
would not build until I removed this from my ~/.gitconfig
(which lets me use ssh authentication with https URLs for github):
[url "git@github.com:"]
insteadOf = https://github.com/
I have not yet gotten flutter_wayland
to work on the device itself. glmark-wayland works, but flutter_wayland
crashes with a segfault and no error messages. There are no symbols, so gdb is not useful.
Is there any way I can determine if this is a bug with Gatesgarth or the imx-image-multimedia
image I'm building? For example, getting debug messages out?
Yes removing your .gitconfig makes sense, or at least associating it with a specific set of repos opposed to all.
You might want to build a debug version of flutter_wayland, as the default is release. Also to look at the wayland dialog execute on target "export WAYLAND_DEBUG=1" prior to execution.
Change flutter-wayland recipe to look like this:
EXTRA_OECMAKE = " \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE=TRUE \
-DFLUTTER_ENGINE_LIBRARY=${STAGING_LIBDIR}/libflutter_engine.so \
"
That should give you symbols. Please share the stack trace.
This may help: https://developer.ridgerun.com/wiki/index.php?title=Preparing_Yocto_Development_Environment_for_Debugging
The other option is to fork flutter_wayland and instrument it with logs statements. This might be faster depending on your current setup.
There has been a recent interface change in flutter_embedder.h that may have impacted things. I'll see if I can repo on another target on my end. I think in general it needs more log statements, at least with a command line option.
Actually what's the output of env
on your target's console window (same window you're starting app from)?
These are minimum required to run:
XDG_RUNTIME_DIR
WAYLAND_DISPLAY
The most common variable missing is WAYLAND_DISPLAY
What's the status? Can I close this?
It still leaks out into the user's home directory, which was the original bug.
Let me try setting PUB_CACHE
and seeing if that fixes it.
This is the patch I've applied, which appears to fix the original issue:
diff --git a/recipes-graphics/flutter-apps/flutter-sdk_git.bb b/recipes-graphics/flutter-apps/flutter-sdk_git.bb
index b23d357..c0855db 100644
--- a/recipes-graphics/flutter-apps/flutter-sdk_git.bb
+++ b/recipes-graphics/flutter-apps/flutter-sdk_git.bb
@@ -25,6 +25,7 @@ S = "${WORKDIR}/git"
do_compile() {
export CURL_CA_BUNDLE=${WORKDIR}/ca-certificates.crt
export PATH=${S}/bin:$PATH
+ export PUB_CACHE=${S}/.pub-cache
flutter channel ${FLUTTER_CHANNEL}
flutter upgrade
}
I've just completed a complete rebuild from scratch to verify this works.
Actually what's the output of
env
on your target's console window (same window you're starting app from)?
It should work, and as I said I can run programs such as weston-terminal
, however flutter_wayland
segfaults:
bash-5.0# env
SHELL=/bin/bash
PWD=/usr/share/flutter-gallery/sony/data
LOGNAME=root
XDG_SESSION_TYPE=tty
MOTD_SHOWN=pam
HOME=/root
LANG=C.UTF-8
WAYLAND_DISPLAY=wayland-0
INVOCATION_ID=e36266bc56d84615b95cda10b029f6d3
XDG_SESSION_CLASS=user
TERM=vt220
USER=root
SHLVL=2
XDG_SESSION_ID=1
XDG_RUNTIME_DIR=/run/user/0
JOURNAL_STREAM=8:2029
HUSHLOGIN=FALSE
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAIL=/var/mail/root
_=/usr/bin/env
OLDPWD=/usr/share/flutter-gallery/sony
bash-5.0# flutter_wayland /usr/share/flutter-gallery/sony/data/flutter_assets/
LOG: /usr/src/debug/flutter-wayland/git-r0/git/src/main.cc:65: Arg: /usr/share/flutter-gallery/sony/data/flutter_assets/
Segmentation fault
bash-5.0# weston-terminal
could not load cursor 'dnd-move'
could not load cursor 'dnd-copy'
could not load cursor 'dnd-none'
^C
bash-5.0#
I can now debug flutter_wayland
, and I can start working on that issue:
bash-5.0# gdb --args flutter_wayland /usr/share/flutter-gallery/sony/data/flutter_assets/
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-poky-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from flutter_wayland...
Reading symbols from /usr/bin/.debug/flutter_wayland...
(gdb) run
Starting program: /usr/bin/flutter_wayland /usr/share/flutter-gallery/sony/data/flutter_assets/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
LOG: /usr/src/debug/flutter-wayland/git-r0/git/src/main.cc:65: Arg: /usr/share/flutter-gallery/sony/data/flutter_assets/
Program received signal SIGSEGV, Segmentation fault.
std::function<void (wayland::seat_capability)>::swap(std::function<void (wayland::seat_capability)>&) (__x=..., this=0xffffffffeee8)
at /usr/include/c++/10.2.0/bits/std_function.h:483
483 std::swap(_M_functor, __x._M_functor);
(gdb) bt
#0 std::function<void (wayland::seat_capability)>::swap(std::function<void (wayland::seat_capability)>&) (__x=...,
this=0xffffffffeee8) at /usr/include/c++/10.2.0/bits/std_function.h:483
#1 std::function<void(wayland::seat_capability)>::operator=<flutter::WaylandDisplay::WaylandDisplay(size_t, size_t, const std::vector<std::__cxx11::basic_string<char> >&)::<lambda(wayland::seat_capability)> > (__f=..., __f=..., this=0x8)
at /usr/include/c++/10.2.0/bits/std_function.h:459
#2 flutter::WaylandDisplay::WaylandDisplay (this=0xffffffffefd0, width=<optimized out>, height=<optimized out>, args=...)
at /usr/src/debug/flutter-wayland/git-r0/git/src/wayland_display.cc:196
#3 0x0000aaaaaaabce04 in flutter::Main (args=...) at /usr/src/debug/flutter-wayland/git-r0/git/src/main.cc:68
#4 0x0000aaaaaaaa59e0 in main (argc=<optimized out>, argv=<optimized out>) at /usr/include/c++/10.2.0/bits/stl_vector.h:102
(gdb)
However, this is outside of the scope of the bug.
Would you like me to create a PR with the PUB_CACHE
patch?
Great thanks for the stack trace. I'll open a new issue for this.
I just checked in the PUB_CACHE change.
I'm not clear about the error case for PUB_CACHE.
Can you help me understand this better? How does the error manifest? Are you developing Flutter app on the same machine that you are building Yocto image?
My concern about the PUB_CACHE
error is that it makes builds non-reproducible.
For example, if you're doing development on your local machine, then it will share the PUB_CACHE
with the build inside Yocto.
Or if you have two builds going at once (e.g. in a CI infrastructure), then two different versions will use the same cache, and it's unclear to me what the implications are of two concurrent builds using the same cache.
Or if you're on a system where home directories are much smaller than the global builder directories.
With https://github.com/jwinarske/meta-flutter/commit/265eab0cbc10bee03d101cb28a78709b5ce0b747 the original issue is solved. Thanks for the fix and the pointers!
I agree with your concern :+1: I just had not hit this yet! Thanks Sean!
The
flutter-sdk_git.bb
recipe leaks out of the sysroot and attempts to read files in the user's home directory.