Android ndk example app doesn't seem to build to missing JNI headers while mobile-install works fine

Đang mở
#470 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
android, cpp
Lĩnh vực
build-system, mobile-dev

Hướng nghiên cứu

Bắt đầu với app/src/main/BUILD.bazel và app/src/main/cpp/native-lib.cpp, sau đó tái hiện lỗi bằng lệnh bazel build được báo cáo và so sánh với bazel mobile-install. Được xem là hoàn tất khi ví dụ Android NDK xây dựng thành công với //app/src/main:app và không còn báo thiếu jni.h.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi,

I am trying to build cpp with ndk for android project and started noticing issues while building. I noticed the same issue is happening in examples repository as well with ndk example...

Ran the below command:

bazel build //app/src/main:app --fat_apk_cpu=x86 --android_crosstool_top=@androidndk//:toolchain

And noticing the below issue in the command prompt.

Starting local Bazel server and connecting to it...
WARNING: For repository 'rules_jvm_external', the root module requires module version [email protected], but got [email protected] in the resolved dependency graph.
DEBUG: /private/var/tmp/_bazel_prasadpamidi/f649ff770c75e43e391c14e7c6ebc48c/external/rules_jvm_external~/private/extensions/maven.bzl:154:14: The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
DEBUG: /private/var/tmp/_bazel_prasadpamidi/f649ff770c75e43e391c14e7c6ebc48c/external/rules_jvm_external~/private/extensions/maven.bzl:154:14: The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
DEBUG: /private/var/tmp/_bazel_prasadpamidi/f649ff770c75e43e391c14e7c6ebc48c/external/rules_jvm_external~/private/extensions/maven.bzl:154:14: The maven repository 'maven' is used in two different bazel modules, originally in '' and now in 'protobuf'
WARNING: /private/var/tmp/_bazel_prasadpamidi/f649ff770c75e43e391c14e7c6ebc48c/external/rules_android~/tools/android/BUILD:271:6: in alias rule @@rules_android~//tools/android:dexsharder: Target '@@rules_android~//tools/android:dexsharder' violates visibility of target '@@bazel_tools//src/tools/android/java/com/google/devtools/build/android/dexer:DexFileSplitter'. Continuing because --nocheck_visibility is active
INFO: Analyzed target //app/src/main:app (368 packages loaded, 17520 targets configured).
INFO: From Building external/rules_jvm_external~/private/tools/java/com/github/bazelbuild/rules_jvm_external/zip/libzip.jar (1 source file) [for tool]:
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
INFO: From Building external/rules_jvm_external~/private/tools/java/com/github/bazelbuild/rules_jvm_external/jar/AddJarManifestEntry.jar (1 source file) [for tool]:
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
INFO: From Building external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/dexer/DexFileSplitter.jar (5 source files) and running annotation processors (AutoValueProcessor) [for tool]:
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
ERROR: /Users/prasadpamidi/examples/android/ndk/app/src/main/BUILD.bazel:17:11: Compiling app/src/main/cpp/native-lib.cpp failed: (Exit 1): cc_wrapper.sh failed: error executing CppCompile command (from target //app/src/main:jni_lib) external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 21 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
app/src/main/cpp/native-lib.cpp:1:10: fatal error: 'jni.h' file not found
#include <jni.h>
         ^~~~~~~
1 error generated.
Target //app/src/main:app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 30.667s, Critical Path: 3.90s
INFO: 44 processes: 11 internal, 30 darwin-sandbox, 3 worker.

This issue isn't happening when i run bazel mobile-install //app/src/main:app --fat_apk_cpu=x86 --start_app --android_crosstool_top=@androidndk//:toolchain.

Am I doing something wrong? is the cpp with ndk not supposed to work with build?

Ngôn ngữ chính
Starlark
Star
958
Fork
582
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bazelbuild/examples

Tất cả issue của bazelbuild/examples

Issue tương tự

Thêm issue về Build System

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.