Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Add support of cross-building the engine for ARM64 Linux Host #20254

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Simon Lightfoot <[email protected]>
Dwayne Slater <[email protected]>
Tetsuhiro Ueda <[email protected]>
shoryukenn <[email protected]>
SOTEC GmbH & Co. KG <[email protected]>
SOTEC GmbH & Co. KG <[email protected]>
Hidenori Matsubayashi <[email protected]>
4 changes: 2 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ group("flutter") {
"//flutter/lib/snapshot:kernel_platform_files",
]

if (current_toolchain == host_toolchain) {
if (current_toolchain == host_toolchain || is_linux) {
public_deps += [
"//flutter/flutter_frontend_server:frontend_server",
"//third_party/dart:create_sdk",
Expand All @@ -71,7 +71,7 @@ group("flutter") {
}

# If on the host, compile tools.
if (current_toolchain == host_toolchain) {
if (current_toolchain == host_toolchain || is_linux) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition no longer matches the comment. Aren't these host tools? It's not clear to me why you are cross-compiling them.

Copy link
Member Author

@HidenoriMatsubayashi HidenoriMatsubayashi Aug 6, 2020

Choose a reason for hiding this comment

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

Yes, I have to modify the comment.

But I couldn't understand why if (current_toolchain == host_toolchain) was necessary. In order to run the Flutter SDK and Flutter Apps on ARM64 Linux platforms, we need to build dart-sdk, frontend_server.dart.snapshot and const_finder.dart.snapshot and so on. This condition is not necessary for cross build.

I think I got it for now. But I think you need to build the following in order to run Flutter SDK on ARM64 Linux. Correct?

  • //flutter/flutter_frontend_server:frontend_server
  • //third_party/dart:create_sdk
  • //flutter/web_sdk
  • //flutter/shell/testing
  • //flutter/tools/const_finder
  • //flutter/tools/font-subset

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the answer to that offhand.

Are they uploaded as artifacts and then downloaded and run by the flutter tool? If so, then you are correct that they aren't host tools, in which case we should instead be deciding when to build them based on support Flutter SDK environments.

Copy link
Member Author

@HidenoriMatsubayashi HidenoriMatsubayashi Aug 17, 2020

Choose a reason for hiding this comment

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

@stuartmorgan
(cc: @christopherfujino please support me.)

Thank you for your reply.

Are they uploaded as artifacts and then downloaded and run by the flutter tool?

That's right.
I think that it is not necessary in the case where only cross build like Android and iOS, however it is necessary when running as Flutter SDK on Host.

I think that all can be built for ARM64 without problems.

//third_party/dart:create_sdk

This is dart-sdk and download to ${INSTALL_PATH}/flutter/bin/cache/dart-sdk. ARM64 is already supported (link)

//flutter/flutter_frontend_server:frontend_server

This is the Dart project, it can be built for ARM64.
It's downloaded to ${INSTALL_PATH}/flutter/bin/cache/artifacts/engine/linux-${arch}/frontend_server.dart.snapshot

//flutter/web_sdk

I'm not sure about this.

//flutter/shell/testing

This is the C++ source code for flutter_test?
It's downloaded to ${INSTALL_PATH}/flutter/bin/cache/artifacts/engine/linux-${arch}/flutter_tester

//flutter/tools/const_finder

This is the Dart project.
It's downloaded to ${INSTALL_PATH}/flutter/bin/cache/artifacts/engine/linux-${arch}/const_finder.dart.snapshot

//flutter/tools/font-subset

This is the C++ source code.
It's downloaded to ${INSTALL_PATH}/flutter/bin/cache/artifacts/engine/linux-${arch}/font-subset

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense; I thought "host" in the comment meant build host, rather that "Flutter host". I think you'll want (is_linux && !is_chromeos) though.

The comment should probably be something like:

# Flutter SDK artifacts should only be built when either doing host builds, or
# for cross-compiled desktop targets.

(I wouldn't mention Linux since macOS and/or Windows could be done this way in the future.)

Also, you should extract this to a variable like build_engine_artifacts since it's used in two places.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you so much. I fixed it. Could you review my change?

public_deps += [
"//flutter/shell/testing",
"//flutter/tools/const_finder",
Expand Down
11 changes: 10 additions & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,23 @@ hooks = [
],
},
{
'name': 'linux_sysroot',
'name': 'linux_sysroot_x64',
'pattern': '.',
'condition': 'download_linux_deps',
'action': [
'python',
'src/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=x64'],
},
{
'name': 'linux_sysroot_arm64',
'pattern': '.',
'condition': 'download_linux_deps',
'action': [
'python',
'src/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=arm64'],
},
{
'name': 'dart package config',
'pattern': '.',
Expand Down