mlcommons / mobile_app_open

Mobile App Open
https://mlcommons.org/en/groups/inference-mobile/
Apache License 2.0
38 stars 19 forks source link

compile error to build the APK #875

Open hcym12 opened 1 month ago

hcym12 commented 1 month ago

While using the latest Android Studio with Flutter plugin to build the mobile_app_open project, it met compile error. Here is the step:

  1. download the latest mobile_app_open-master.zip here.
  2. open the mobile_app_open-master\flutter with Android Stuido.
  3. Build->Flutter->Build APK.
  4. met compile error as below(full log mobile_app_open-compile-error.log):

C:\flutter\bin\flutter.bat --no-color build apk Waiting for another flutter command to release the startup lock...

Building with sound null safety

Running Gradle task 'assembleRelease'...
Using signingConfigs.debug mappingFileUploadEnabled set to false lib/benchmark/run_mode.dart:1:8: Error: Error when reading 'lib/localizations/app_localizations.dart': The system cannot find the path specified.

import 'package:mlperfbench/localizations/app_localizations.dart'; ^ lib/ui/root/app.dart:5:8: Error: Error when reading 'lib/localizations/app_localizations.dart': The system cannot find the path specified.

import 'package:mlperfbench/localizations/app_localizations.dart'; ^ lib/ui/root/unsupported_device_screen.dart:3:8: Error: Error when reading 'lib/localizations/app_localizations.dart': The system cannot find the path specified. ...

I saw the release includes the pre-built mlperfbench-v3.1-qsmgt.apk at https://github.com/mlcommons/mobile_app_open/releases/tag/v3.1.

Could someone share the the detail steps about how to build the APK from the sourececode from scratch? Thank you very much!

anhappdev commented 1 month ago

Please take a look at the documentation at https://github.com/mlcommons/mobile_app_open/tree/master/docs you will find the instructions to build the app.

hcym12 commented 1 month ago

Hi Anhappdev, Thank you very much for your information. As the documentation, I tried to setup the build environment under the Ubuntu 22.04, and run the "flutter doctor -v" with no issue:

$ flutter doctor -v [?] Flutter (Channel stable, 3.7.6, on Ubuntu 22.04.4 LTS 5.15.0-102-generic, locale en_US.UTF-8) ? Flutter version 3.7.6 on channel stable at /home/hcym12/tools/flutter ? Upstream repository https://github.com/flutter/flutter.git ? Framework revision 12cb4eb7a0 (1 year, 2 months ago), 2023-03-01 10:29:26 -0800 ? Engine revision ada363ee93 ? Dart version 2.19.3 ? DevTools version 2.20.1

[?] Android toolchain - develop for Android devices (Android SDK version 34.0.0) ? Android SDK at /home/hcym12/Android/Sdk ? Platform android-34, build-tools 34.0.0 ? Java binary at: /home/hcym12/Android/android-studio/jre/bin/java ? Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) ? All Android licenses accepted.

[?] Chrome - develop for the web ? Chrome at google-chrome

[?] Linux toolchain - develop for Linux desktop ? Ubuntu clang version 14.0.0-1ubuntu1.1 ? cmake version 3.22.1 ? ninja version 1.10.1 ? pkg-config version 0.29.2

[?] Android Studio (version 2023.2) ? Android Studio at /home/hcym12/Android/android-studio ? Flutter plugin can be installed from: ? https://plugins.jetbrains.com/plugin/9212-flutter ? Dart plugin can be installed from: ? https://plugins.jetbrains.com/plugin/6351-dart ? Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[?] Connected device (2 available) ? Linux (desktop) ? linux ? linux-x64 ? Ubuntu 22.04.4 LTS 5.15.0-102-generic ? Chrome (web) ? chrome ? web-javascript ? Google Chrome 124.0.6367.91

[?] HTTP Host Availability ? All required HTTP hosts are available

? No issues found!

However, while building the mobile_app_open-3.1, it still failed as below (full log at mobile_app_open-3.1-compile-error.log ):


ERROR: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/partials/resources.bzl:235:5: nested functions are not allowed. Move the function to the top level.
INFO: Repository rules_cc instantiated at:
  /DEFAULT.WORKSPACE.SUFFIX:241:6: in <toplevel>
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/bazel_tools/tools/build_defs/repo/utils.bzl:201:18: in maybe
Repository rule http_archive defined at:
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
INFO: Repository build_bazel_rules_android instantiated at:
  /public/hcym12/git/mlperf/mobile_app_open-3.1/WORKSPACE:88:14: in <toplevel>
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/tensorflow/workspace2.bzl:888:21: in workspace
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/tensorflow/workspace2.bzl:792:20: in _tf_repositories
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:128:21: in tf_http_archive
Repository rule _tf_http_archive defined at:
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:81:35: in <toplevel>
INFO: Repository bazel_skylib instantiated at:
  /public/hcym12/git/mlperf/mobile_app_open-3.1/WORKSPACE:20:25: in <toplevel>
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/repositories.bzl:99:11: in apple_rules_dependencies
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/repositories.bzl:86:14: in _maybe
Repository rule http_archive defined at:
  /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
ERROR: Skipping '//flutter/cpp/flutter:libbackendbridge.so': error loading package 'flutter/cpp/flutter': in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/apple.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/apple_framework_import.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/rule_factory.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/testing/apple_test_bundle_support.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/partials.bzl: Extension 'apple/internal/partials/resources.bzl' has errors
ERROR: error loading package 'flutter/cpp/flutter': in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/apple.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/apple_framework_import.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/rule_factory.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/testing/apple_test_bundle_support.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/partials.bzl: Extension 'apple/internal/partials/resources.bzl' has errors
INFO: Elapsed time: 231.490s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
    currently loading: mobile_back_tflite/cpp/backend_tflite
make: *** [flutter/android/android.mk:37: flutter/android/libs/build] Error 1

I saw there is warning about couldn't find resource "WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/c3e082762b7664bbc7ffd2c39e86464928e27c0c.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found", was it relate to network access limitation?

BTW, I also tried the latest code of mobile_app_open-master, it had the similar error and warning about not finding the resource download.

Any advice about the issue?

anhappdev commented 1 month ago

@hcym12 Please try to run the followings command one at a time and see if you encounter any error:

make flutter/prepare
make flutter/android
make flutter/run
hcym12 commented 3 weeks ago

Hi Anhappdev, I encounter error while running "make flutter/android" as below (full log at mobile_app_open-3.1-compile-error_20240o507.log ):

mobile_app_open-3.1$ make flutter/android WITH_TFLITE=1 Skip checksum validation bazel \ build --symlink_prefix bazel- \ --config=android_arm64 \ //mobile_back_tflite/cpp/backend_tflite:libtflitebackend.so \ \ \ \ \ //flutter/cpp/flutter:libbackendbridge.so Extracting Bazel installation... Starting local Bazel server and connecting to it... INFO: Options provided by the client: Inherited 'common' options: --isatty=1 --terminal_columns=209 INFO: Reading rc options for 'build' from /public/hcym12/git/mlperf/mobile_app_open-3.1/.bazelrc: Inherited 'common' options: --experimental_repo_remote_exec INFO: Reading rc options for 'build' from /public/hcym12/git/mlperf/mobile_app_open-3.1/.bazelrc: 'build' options: -c opt --announce_rc --config=short_logs --verbose_failures --spawn_strategy=standalone INFO: Found applicable config definition build:short_logs in file /public/hcym12/git/mlperf/mobile_app_open-3.1/.bazelrc: --output_filter=DONT_MATCH_ANYTHING INFO: Found applicable config definition build:android_arm64 in file /public/hcym12/git/mlperf/mobile_app_open-3.1/.bazelrc: --config=android --cpu=arm64-v8a --fat_apk_cpu=arm64-v8a INFO: Found applicable config definition build:android in file /public/hcym12/git/mlperf/mobile_app_open-3.1/.bazelrc: --copt=-w --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --crosstool_top=//external:android/crosstool --host_crosstool_top=@bazel_tools//tools/cpp:toolchain WARNING: Download from https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/c3e082762b7664bbc7ffd2c39e86464928e27c0c.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found DEBUG: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:124:14: Warning: skipping import of repository 'cpuinfo' because it already exists. DEBUG: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:124:14: Warning: skipping import of repository 'com_google_protobuf' because it already exists. DEBUG: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:124:14: Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists. DEBUG: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:124:14: Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists. DEBUG: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:124:14: Warning: skipping import of repository 'build_bazel_apple_support' because it already exists. DEBUG: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/org_tensorflow/third_party/repo.bzl:124:14: Warning: skipping import of repository 'xctestrunner' because it already exists. ERROR: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/partials/resources.bzl:235:5: nested functions are not allowed. Move the function to the top level. INFO: Repository bazel_skylib instantiated at: /public/hcym12/git/mlperf/mobile_app_open-3.1/WORKSPACE:20:25: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/repositories.bzl:99:11: in apple_rules_dependencies /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/repositories.bzl:86:14: in _maybe Repository rule http_archive defined at: /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in ERROR: Skipping '//flutter/cpp/flutter:libbackendbridge.so': error loading package 'flutter/cpp/flutter': in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/apple.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/xcframework_rules.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/partials.bzl: Extension 'apple/internal/partials/resources.bzl' has errors ERROR: error loading package 'flutter/cpp/flutter': in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/apple.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/xcframework_rules.bzl: in /home/hcym12/.cache/bazel/_bazel_hcym12/6545aa99df0c96aba6be20c2a07f5c36/external/build_bazel_rules_apple/apple/internal/partials.bzl: Extension 'apple/internal/partials/resources.bzl' has errors INFO: Elapsed time: 335.027s INFO: 0 processes. FAILED: Build did NOT complete successfully (1 packages loaded) currently loading: mobile_back_tflite/cpp/backend_tflite Fetching @local_config_cuda; fetching make: *** [flutter/android/android.mk:37: flutter/android/libs/build] Error 1

Please refer to the bold warning, looks like it couldn't download the resource.

anhappdev commented 3 weeks ago

@hcym12 Can you try using Docker to build the app to see if the issue related to your system environment or not.

OFFICIAL_BUILD=false FLUTTER_BUILD_NUMBER=1 make docker/flutter/android/release