Comments (4)
@timpeut @juliexxia Do you know if this is the correct place to ask this question?
from rules_android.
How are you invoking the build? What's your bazel command line?
This is probably an incompatibility between Android rules (which are not currently using toolchain resolution) and the Rust rules (which do use toolchain resolution). We are working on the former (see bazelbuild/bazel#11749). There should be a way to have your build work currently, by adding the extra flags needed, but I will need a little more information to help figure it out.
from rules_android.
@katre Hi! Thank you so much for the reply!
I've put together a small workspace to reproduce the issue. Simply running bazel build //...
should generate the error above.
In case it helps, the .bazelrc
file I use only contains
common --experimental_google_legacy_api
├── BUILD.bazel
├── WORKSPACE
├── android
│ ├── BUILD.bazel
│ ├── proguard-rules.pro
│ └── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── LibraryManifest.xml
│ ├── java
│ │ └── io
│ │ └── uebel
│ │ └── example
│ │ └── MainActivity.java
│ └── res
│ ├── drawable
│ │ └── ic_launcher_background.xml
│ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ ├── layout
│ │ └── activity_main.xml
│ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
└── rust
├── BUILD.bazel
├── Cargo.lock
├── Cargo.toml
├── raze
│ ├── BUILD.bazel
│ ├── crates.bzl
│ └── remote
│ ├── BUILD.bazel
│ ├── addr2line-0.13.0.BUILD.bazel
│ ├── adler-0.2.3.BUILD.bazel
│ ├── ansi_term-0.11.0.BUILD.bazel
│ ├── atty-0.2.14.BUILD.bazel
│ ├── backtrace-0.3.50.BUILD.bazel
│ ├── bitflags-1.2.1.BUILD.bazel
│ ├── bytes-0.5.6.BUILD.bazel
│ ├── cesu8-1.1.0.BUILD.bazel
│ ├── cfg-if-0.1.10.BUILD.bazel
│ ├── clap-2.33.1.BUILD.bazel
│ ├── combine-4.2.1.BUILD.bazel
│ ├── error-chain-0.10.0.BUILD.bazel
│ ├── error-chain-0.12.3.BUILD.bazel
│ ├── ferris-says-0.2.0.BUILD.bazel
│ ├── gimli-0.22.0.BUILD.bazel
│ ├── hermit-abi-0.1.15.BUILD.bazel
│ ├── jni-0.17.0.BUILD.bazel
│ ├── jni-sys-0.3.0.BUILD.bazel
│ ├── libc-0.2.74.BUILD.bazel
│ ├── log-0.4.11.BUILD.bazel
│ ├── memchr-2.3.3.BUILD.bazel
│ ├── miniz_oxide-0.4.0.BUILD.bazel
│ ├── object-0.20.0.BUILD.bazel
│ ├── rustc-demangle-0.1.16.BUILD.bazel
│ ├── same-file-1.0.6.BUILD.bazel
│ ├── smallvec-0.4.5.BUILD.bazel
│ ├── strsim-0.8.0.BUILD.bazel
│ ├── textwrap-0.11.0.BUILD.bazel
│ ├── unicode-width-0.1.8.BUILD.bazel
│ ├── vec_map-0.8.2.BUILD.bazel
│ ├── version_check-0.9.2.BUILD.bazel
│ ├── walkdir-2.3.1.BUILD.bazel
│ ├── winapi-0.3.9.BUILD.bazel
│ ├── winapi-i686-pc-windows-gnu-0.4.0.BUILD.bazel
│ ├── winapi-util-0.1.5.BUILD.bazel
│ └── winapi-x86_64-pc-windows-gnu-0.4.0.BUILD.bazel
└── src
└── lib.rs
22 directories, 68 files
from rules_android.
Thanks for the test case. This has existed since at least Bazel 3.2.0, and possibly earlier.
The problem is that the Android binary is changing the configuration to use the c compiler from the NDK (which makes sense), but the rust rules are trying to access that using the legacy system and an invalid --cpu
flag (with the deafult value, k8).
I'm not entirely sure where this is happening: it could be rules_rust, rules_android, or Bazel itself. We're in the process of migrating the Android rules to use toolchain resolution, which will also unblock using toolchain resolution for C++ code: this should make this much simpler because each set of rules will be using the same configuration settings to tell what platform to build for.
I'm going to keep poking and see if there's an easy way to get your build working without waiting for those efforts to finish. You might also consider asking on the mailing lists if anyone else is using an Android binary with another set of rules to build binary code: rules_rust, rules_go, and several others are all very similar and a fix for one might work for you, even if it's not specifically for rust.
from rules_android.
Related Issues (20)
- The Starlark implementaiton of process_deploy_jar fails to execute java.create_deploy_jar HOT 5
- Build fails when `--incremental_dexing` is disabled HOT 1
- Remove dependencies on --experimental_google_legacy_api and --experimental_enable_android_migration_apis HOT 2
- Can't build example basicapp HOT 5
- _copy_file and _copy_dir fail on macOS
- AAR libraries from Maven don't expose their resources unlike in built-in Android rules HOT 3
- Mobile install v3 doesn't work with --start=debug HOT 1
- Flags underneath rules/flags/ aren't working correctly HOT 1
- Android platforms breaks incremental dexing and desugaring HOT 4
- mobile-install fails with dependencies from rules_jvm_external HOT 7
- Unable to build with rules_android due to maven install issue HOT 2
- [Bazel CI] android_sdk_repository & android_sdk_repository_platforms_tests are failing with Bazel@HEAD HOT 1
- Bazel query broken at HEAD
- [Bazel CI] ERROR occurred during the fetch of repository 'rules_android_maven'
- APK doesn't include *.version files in metadata
- Rules use entire Android SDK dir as input instead of explicit files which may case poor cache hit HOT 1
- documentation for targets under android_sdk_repository
- Bash is not necessarily in /bin/bash
- No matching toolchains found for types @@bazel_tools//tools/android:sdk_toolchain_type even though called register_toolchains HOT 2
- [FR] Option for mobile-install command to install to all connected devices
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_android.