Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Flutter Template #275

Open
wants to merge 33 commits into
base: dev
Choose a base branch
from
Open

Adds Flutter Template #275

wants to merge 33 commits into from

Conversation

alberrizwan
Copy link

This is draft release of Flutter template.
Please note:
To manually attach to the device for debugging, follow these steps:

  1. SSH into the device and run docker logs .
  2. Find the Observatory URL in the logs.
  3. Open another SSH terminal and set up port forwarding using this command: ssh -L port:127.0.0.1:port user@deviceIP, where port corresponds to the one in the Observatory URL.
  4. Once port forwarding is established, open the Observatory URL in a web browser.
  5. You can now start debugging using the web debugger.

Signed-off-by: [email protected]

##
# Build/Deploy Step
##
FROM crossware.app:5050/toradex/flutter:${SDK_BASE_VERSION} as build
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @alberrizwan,
Sorry for taking a bit of time to the PR review, we are on the process of a new major release of Torizon (Torizon 7).
I created a project form the template and tried to build it, but fell into the following issue:

 *  Executing task: DOCKER_HOST= docker compose build --pull --build-arg SSHUSERNAME=torizon --build-arg APP_ROOT=/home/torizon/app --build-arg IMAGE_ARCH=arm64 --build-arg DEBUG_SSH_PORT= --build-arg GPU=-vivante testflutter-debug 

WARN[0000] The "DOCKER_LOGIN" variable is not set. Defaulting to a blank string. 
WARN[0000] /home/andreriesco/Documents/IDE2.0/test-applications/testFlutter/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Building 2.6s (3/3) FINISHED                                        docker-container:sharp_murdock
 => [testflutter-debug internal] load build definition from Dockerfile.debug                      0.3s
 => => transferring dockerfile: 1.23kB                                                            0.0s
 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 26)                   0.3s
 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 36)                   0.3s
 => ERROR [testflutter-debug internal] load metadata for crossware.app:5050/toradex/flutter:runt  2.1s
 => CANCELED [testflutter-debug internal] load metadata for crossware.app:5050/toradex/flutter:e  2.1s
------
 > [testflutter-debug internal] load metadata for crossware.app:5050/toradex/flutter:runtime_debug:
------
failed to solve: crossware.app:5050/toradex/flutter:runtime_debug: failed to resolve source metadata for crossware.app:5050/toradex/flutter:runtime_debug: failed to authorize: failed to fetch anonymous token: unexpected status from GET request to https://crossware.app/jwt/auth?scope=repository%3Atoradex%2Fflutter%3Apull&service=container_registry: 403 Forbidden

 *  The terminal process "/usr/bin/bash '-c', 'DOCKER_HOST= docker compose build --pull --build-arg SSHUSERNAME=torizon --build-arg APP_ROOT=/home/torizon/app --build-arg IMAGE_ARCH=arm64 --build-arg DEBUG_SSH_PORT= --build-arg GPU=-vivante testflutter-debug'" terminated with exit code: 17. 
 *  Terminal will be reused by tasks, press any key to close it. 

It seems that the base container is not publicly available.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @alberrizwan,
Any updates on this issue?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @andreriesco,
Sorry for the delayed response, I have made the requested changes please check and let us know if any more changes are required.

Copy link
Collaborator

@andreriesco andreriesco Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @alberrizwan ,
Thanks, now I was able to get the base images and run the application.
But I have an issue to debug the application. I followed the steps do debug it, but I am falling into the following error:

$ dart devtools http://127.0.0.1:43739/k8IUol2dnPI=/
WebSocketException: Connection to 'http://127.0.0.1:43739/k8IUol2dnPI=/ws#' was not upgraded to websocket, HTTP status code: 403
#0      _WebSocketImpl.connect (dart:_http/websocket_impl.dart:1011:41)
#1      WebSocket.connect (dart:_http/websocket.dart:320:22)
#2      vmServiceConnectUriWithFactory (package:vm_service/vm_service_io.dart:26:44)
#3      vmServiceConnectUri (package:vm_service/vm_service_io.dart:12:10)
#4      DevToolsCommand.maybeStartDDS (package:dartdev/src/commands/devtools.dart:192:29)
#5      DevToolsCommand._performDDSCheck (package:dartdev/src/commands/devtools.dart:106:19)
<asynchronous suspension>
#6      DevToolsCommand.run (package:dartdev/src/commands/devtools.dart:57:21)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#8      DartdevRunner.runCommand (package:dartdev/dartdev.dart:240:18)
<asynchronous suspension>
#9      runDartdev (package:dartdev/dartdev.dart:47:16)
<asynchronous suspension>
#10     main (file:///b/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:13:5)
<asynchronous suspension>

And even if I try to disable-service-auth-codes (and also set a fixed port, as explained in this article), I still get an error (but with error code 200):

dart devtools http://127.0.0.1:12345/k8IUol2dnPI=/
WebSocketException: Connection to 'http://127.0.0.1:12345/k8IUol2dnPI=/ws#' was not upgraded to websocket, HTTP status code: 200
#0      _WebSocketImpl.connect (dart:_http/websocket_impl.dart:1011:41)
#1      WebSocket.connect (dart:_http/websocket.dart:320:22)
#2      vmServiceConnectUriWithFactory (package:vm_service/vm_service_io.dart:26:44)
#3      vmServiceConnectUri (package:vm_service/vm_service_io.dart:12:10)
#4      DevToolsCommand.maybeStartDDS (package:dartdev/src/commands/devtools.dart:192:29)
#5      DevToolsCommand._performDDSCheck (package:dartdev/src/commands/devtools.dart:106:19)
<asynchronous suspension>
#6      DevToolsCommand.run (package:dartdev/src/commands/devtools.dart:57:21)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#8      DartdevRunner.runCommand (package:dartdev/dartdev.dart:240:18)
<asynchronous suspension>
#9      runDartdev (package:dartdev/dartdev.dart:47:16)
<asynchronous suspension>
#10     main (file:///b/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:13:5)
<asynchronous suspension>

Do you know what may be possible issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi guys,

Do you have any update about this issue?

Copy link
Collaborator

@andreriesco andreriesco Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @alberrizwan,
Were you able even to debug the application on Torizon 6?
For Torizon 7, the major of the base containers need to be changed from 3 to 4. Also, the -vivante containers have been replaced with -imx8 containers, so for example the weston-vivante on Torizon 6 is now weston-imx8 on Torizon 7

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I was able to debug with torizon 6, and Thanks for the Information on the vivante container, I will make this change and test.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @andreriesco, could you please confirm if this works with Torizon 6, at first glance the Torizon core 7 seems to have a significant change especially graphic driver compared to Torizon 6.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @alberrizwan, on Torizon 6 it worked for me, the application is shown on the screen, the only thing that I wasn't able to make work was the debugging here.
On Torizon 7, some things may have changed on the graphical containers side, but I am not sure which changes could have been made there. But in practice it should not impact the way of using them.
I would recommend trying to update this torizon.gpuPrefixRC setting to true and maybe trying to update the cgroups, like in this commit. Also, the name of some containers had a little change, but I don't think that you are using any of the ones that changed the name.
Which is the error that is happening to you? Also, which SoM and Carrier Board are you using for testing (right now for example I believe that is a known bug on the native HDMI of the Dahlia carrier board)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @andreriesco, Thanks for the Suggestions, I have been able to make it work with torizon 7 by changing the flutter runtime base to wayland-base-imx8 from wayland-base-vivante, however I wasn't to able reproduce the debug websocket Issue on my machines, would it be possible for us to setup a call and Discuss this Issue.

Environment details:
Host device : Ubuntu 22.04
target device: Verdin-iMX8MP

@microhobby microhobby force-pushed the dev branch 22 times, most recently from 97f62c0 to e169b0e Compare January 16, 2025 02:36
alberrizwan and others added 29 commits February 21, 2025 00:21
Some small fixes (formatting and weston major)
Signed-off-by: Andre Riesco <[email protected]>
Signed-off-by: Andre Riesco <[email protected]>
Remove release part on debug, as it is executed by task
run-container-release-<arch>.

Signed-off-by: Andre Riesco <[email protected]>
Build the debug application saving the build on the workspace, therefore
caching it for the next builds.
Also, copy the application to the board through rsync instead of in a
Docker layer, to avoid the decompression of the application layer on the
board.

Signed-off-by: Andre Riesco <[email protected]>
Signed-off-by: Andre Riesco <[email protected]>
Signed-off-by: Andre Riesco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants