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

[native_toolchain_c] Setup Android RISCV64 toolchain. #165

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion pkgs/native_toolchain_c/lib/src/cbuilder/run_cbuilder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ class RunCBuilder {
// See https://github.com/dart-lang/native/issues/171.
late final int targetAndroidNdkApi;
if (target.os == OS.android) {
targetAndroidNdkApi = max(buildConfig.targetAndroidNdkApi!, 21);
final minimumApi = target == Target.androidRiscv64 ? 35 : 21;
targetAndroidNdkApi = max(buildConfig.targetAndroidNdkApi!, minimumApi);
}

await runProcess(
Expand Down Expand Up @@ -294,6 +295,7 @@ class RunCBuilder {
Target.androidArm64: 'aarch64-linux-android',
Target.androidIA32: 'i686-linux-android',
Target.androidX64: 'x86_64-linux-android',
Target.androidRiscv64: 'riscv64-linux-android',
};

static const appleClangMacosTargetFlags = {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_toolchain_c/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
glob: ^2.1.1
logging: ^1.1.1
meta: ^1.9.1
native_assets_cli: ^0.3.0
native_assets_cli: ^0.3.2
pub_semver: ^2.1.3

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,24 @@ void main() {
Target.androidArm64,
Target.androidIA32,
Target.androidX64,
// TODO(rmacnak): Enable when stable NDK 27 is available.
// Target.androidRiscv64,
Copy link
Collaborator

Choose a reason for hiding this comment

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

@rmacnak-google Can this PR be landed or are we blocked on having NDK 27?

It looks like that will be only in the new year: https://github.com/android/ndk/wiki#ndk-r27-lts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can land this if you're okay with leaving this test disabled, otherwise we need to wait for NDK 27.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay lets land it then 👍 The changes eyeballed look good.

];

const readElfMachine = {
Target.androidArm: 'ARM',
Target.androidArm64: 'AArch64',
Target.androidIA32: 'Intel 80386',
Target.androidX64: 'Advanced Micro Devices X86-64',
Target.androidRiscv64: 'RISC-V',
};

const objdumpFileFormat = {
Target.androidArm: 'elf32-littlearm',
Target.androidArm64: 'elf64-littleaarch64',
Target.androidIA32: 'elf32-i386',
Target.androidX64: 'elf64-x86-64',
Target.androidRiscv64: 'elf64-littleriscv',
};

/// From https://docs.flutter.dev/reference/supported-platforms.
Expand Down