flutter-elinux
                                
                                
                                
                                    flutter-elinux copied to clipboard
                            
                            
                            
                        How to use it on Jetson Nano?
I have followed the steps
$ flutter-elinux create sample
$ cd sample
$ flutter-elinux run -d elinux-wayland
But it just run on ubuntu x86 I want to run it on DRM mode of Jetson Nano. How to use it? Can I cross compile the flutter app? Thanks!
Please check the following wikis:
- https://github.com/sony/flutter-elinux/wiki/Building-flutter-apps
 - https://github.com/sony/flutter-embedded-linux/tree/master/examples/flutter-drm-eglstream-backend
 
Hello. Can you tell me what's different of flutter-elinux and flutter-embedded-linux ? I'm confuse about this.
flutter-elinux is a build and debug tool for elinux (embedded linux). Whereas flutter-embedded-linux is a porting layer of Flutter engine for elinux. Please check READMEs.
Here is my compile command.
~/flutter-elinux$ bin/flutter-elinux build elinux --target-backend-type=eglstsroot=/media/alfred/nfs/ --target-arch=arm64 --target-compiler-triple=aarch64-linux-gnu
/media/alfred/nfs/  is the / of jetson nano
At last, it shows that Downloading elinux-x64-release tools...                                ⣻Downloading elinux-x64-release tools...                            12.2s Target file "lib/main.dart" not found.
I don't know if it works well.
And then I see the directory of engine
~/flutter-elinux/flutter/bin/cache/artifacts/engine$ ls
android-arm64-profile  android-arm-release  common                elinux-arm64-release  elinux-x64-profile
android-arm64-release  android-x64-profile  elinux-arm64-debug    elinux-common         elinux-x64-release
android-arm-profile    android-x64-release  elinux-arm64-profile  elinux-x64-debug      linux-x64
~/flutter-elinux/flutter/bin/cache/artifacts/engine/elinux-arm64-release$ ls
libflutter_elinux_eglstream.so  libflutter_elinux_wayland.so  libflutter_engine.so
libflutter_elinux_gbm.so        libflutter_elinux_x11.so      linux-x64
It seems that I have compiled the project.
And then I create a flutter project
~/flutter-elinux/bin/flutter-elinux build elinux --target-backend-type=eglstream --target-sysroot=/media/alfred/nfs/ --target-arch=arm64 --target-compiler-triple=aarch64-linux-gnu
/media/alfred/nfs/  is the / of jetson nano
At last,
Failed to cmake build:
Scanning dependencies of target flutter_assemble
[  0%] Built target flutter_assemble
Scanning dependencies of target flutter_wrapper_plugin
[  7%] Building CXX object flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_client_wrapper/core_implementations.cc.o
[ 15%] Building CXX object flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_client_wrapper/standard_codec.cc.o
[ 23%] Building CXX object flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_client_wrapper/plugin_registrar.cc.o
[ 30%] Linking CXX static library libflutter_wrapper_plugin.a
[ 30%] Built target flutter_wrapper_plugin
Scanning dependencies of target flutter_wrapper_app
[ 38%] Building CXX object flutter/CMakeFiles/flutter_wrapper_app.dir/ephemeral/cpp_client_wrapper/core_implementations.cc.o
[ 46%] Building CXX object flutter/CMakeFiles/flutter_wrapper_app.dir/ephemeral/cpp_client_wrapper/standard_codec.cc.o
[ 53%] Building CXX object flutter/CMakeFiles/flutter_wrapper_app.dir/ephemeral/cpp_client_wrapper/flutter_engine.cc.o
[ 61%] Building CXX object flutter/CMakeFiles/flutter_wrapper_app.dir/ephemeral/cpp_client_wrapper/flutter_view_controller.cc.o
[ 69%] Linking CXX static library libflutter_wrapper_app.a
[ 69%] Built target flutter_wrapper_app
Scanning dependencies of target sample
[ 76%] Building CXX object runner/CMakeFiles/sample.dir/flutter_window.cc.o
[ 84%] Building CXX object runner/CMakeFiles/sample.dir/main.cc.o
[ 92%] Building CXX object runner/CMakeFiles/sample.dir/__/flutter/generated_plugin_registrant.cc.o
[100%] Linking CXX executable sample
runner/CMakeFiles/sample.dir/build.make:116: recipe for target 'runner/sample' failed
CMakeFiles/Makefile2:199: recipe for target 'runner/CMakeFiles/sample.dir/all' failed
Makefile:129: recipe for target 'all' failed
/usr/bin/aarch64-linux-gnu-ld: 找不到 -lgcc_s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [runner/sample] Error 1
make[1]: *** [runner/CMakeFiles/sample.dir/all] Error 2
make: *** [all] Error 2
But I can find the libgcc_s.so in the toolchain
/usr/bin/aarch64-linux-gnu-ld --verbose | grep SEARCH_DIR
SEARCH_DIR("=/usr/local/lib/aarch64-linux-gnu"); SEARCH_DIR("=/lib/aarch64-linux-gnu"); SEARCH_DIR("=/usr/lib/aarch64-linux-gnu"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); SEARCH_DIR("=/usr/aarch64-linux-gnu/lib");
ll /usr/aarch64-linux-gnu/lib/libgcc_s.so*
lrwxrwxrwx 1 root root    13 6月  21 10:55 /usr/aarch64-linux-gnu/lib/libgcc_s.so -> libgcc_s.so.1
-rw-r--r-- 1 root root 80168 3月  11  2020 /usr/aarch64-linux-gnu/lib/libgcc_s.so.1
cmake is 3.15 aarch64-linux-gnu is 7.5.
I compile it on the jetson nano and I run a created project
flutter-elinux build elinux --profile --target-backend-type=eglstream
sudo FLUTTER_DRM_DEVICE=drm-nvdc ./sample --bundle=~/sample/build/elinux/arm64/profile/bundle
[ERROR][NativeWindowDrm(22)] Couldn't open drm-nvdc
[ERROR][CreateRenderSurface(118)] Failed to create the native window
Failed to create view controller.
I don't know the  FLUTTER_DRM_DEVICE of jetson.
I see the jetson sample #define DRM_DEVICE_NAME "drm-nvdc"
I am using jetpack 4.6
I see the jetson sample #define DRM_DEVICE_NAME "drm-nvdc"
I don't think so as "/dev/dri/card0" is common, but I don't remember it.
I see the jetson sample #define DRM_DEVICE_NAME "drm-nvdc"
I don't think so as "/dev/dri/card0" is common, but I don't remember it.
Maybe you use jetpack 4.3. But now I am using jetpack4.6.
~$ ls /dev/dri/card0
ls: cannot access '/dev/dri/card0': No such file or directory
How can I fix it? Maybe it can't use udev for drm.
Here is the link that jetson doesn't have the "/dev/dri/card0". https://forums.developer.nvidia.com/t/why-doesnt-jetson-have-the-directory-of-dev-dri-drm/218578 How dose flutter-elinux use the drm?
@HidenoriMatsubayashi I see your video of youtube. I see your demo is nano. Can you tell me which jetpack you used?
@HidenoriMatsubayashi
I have a test on jetson nano jp4.3. But I can't find the /dev/dri/card0 too.
How can you do it on jetson nano?
I'll close the issue. See https://github.com/sony/flutter-elinux/issues/121