irondash / cargokit

Integrate cargo build with flutter plugins and applications.
Other
51 stars 16 forks source link

failing to build a flutter_rust_bridge_codegen app for android under fedora (can not find crate core) #69

Closed iota-xSK closed 1 month ago

iota-xSK commented 1 month ago

I have already posted this to the flutter_rust_bridge repo and they told me to go here.

I have manually installed flutter and android sdk and ndk. I can build the basic example for linux, but for android it can not find the core crate, even though I have the rust targets installed. I ran the suggested command but it did not help, I do have the targets installed as you can see from the logs posted below.

Steps to reproduce

  1. flutter_rust_bridge_codegen create osc3
    1. cd osc3/
    2. flutter build apk
`SEVERE: ================================================================================
SEVERE: Cargokit BuildTool failed with error:
SEVERE: --------------------------------------------------------------------------------
SEVERE: External Command: rustup "run" "stable" "cargo" "build" "--manifest-path" "/home/iota/Code/testing/osc3/rust/Cargo.toml" "-p" "rust_lib_osc3" "--release" "--target" "armv7-linux-androideabi" "--target-dir" "/home/iota/Code/testing/osc3/build/rust_lib_osc3/build"
SEVERE: Returned Exit Code: 101
SEVERE: --------------------------------------------------------------------------------
SEVERE: STDOUT:
SEVERE: --------------------------------------------------------------------------------
SEVERE: STDERR:
SEVERE: Compiling memchr v2.6.4
SEVERE:    Compiling libc v0.2.150
SEVERE:    Compiling proc-macro2 v1.0.70
SEVERE:    Compiling unicode-ident v1.0.12
SEVERE: error[E0463]: can't find crate for `core`
SEVERE:   |
SEVERE:   = note: the `armv7-linux-androideabi` target may not be installed
SEVERE:   = help: consider downloading the target with `rustup target add armv7-linux-androideabi`
SEVERE: 
SEVERE: For more information about this error, try `rustc --explain E0463`.
SEVERE: error: could not compile `memchr` (lib) due to 1 previous error
SEVERE: warning: build failed, waiting for other jobs to finish...
SEVERE: --------------------------------------------------------------------------------
SEVERE: #0      runCommand (package:build_tool/src/util.dart:121:5)
SEVERE: #1      RustBuilder.build (package:build_tool/src/builder.dart:142:5)
SEVERE: <asynchronous suspension>
SEVERE: #2      ArtifactProvider.getArtifacts (package:build_tool/src/artifacts_provider.dart:71:25)
SEVERE: <asynchronous suspension>
SEVERE: #3      BuildGradle.build (package:build_tool/src/build_gradle.dart:35:23)
SEVERE: <asynchronous suspension>
SEVERE: #4      BuildGradleCommand.runBuildCommand (package:build_tool/src/build_tool.dart:65:5)
SEVERE: <asynchronous suspension>
SEVERE: #5      BuildCommand.run (package:build_tool/src/build_tool.dart:37:5)
SEVERE: <asynchronous suspension>
SEVERE: #6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
SEVERE: <asynchronous suspension>
SEVERE: #7      runMain (package:build_tool/src/build_tool.dart:251:5)
SEVERE: <asynchronous suspension>
SEVERE: --------------------------------------------------------------------------------
SEVERE: BuildTool arguments: [build-gradle]
SEVERE: ================================================================================

FAILURE: Build failed with an exception.

* Where:
Script '/home/iota/Code/testing/osc3/rust_builder/cargokit/gradle/plugin.gradle' line: 68

* What went wrong:
Execution failed for task ':rust_lib_osc3:cargokitCargoBuildRust_lib_osc3Release'.
> Process 'command '/home/iota/Code/testing/osc3/rust_builder/cargokit/gradle/../run_build_tool.sh'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s
$ rustup target list --installed
aarch64-linux-android
armv7-linux-androideabi
i686-linux-android
x86_64-linux-android
x86_64-unknown-linux-gnu
iota-xSK commented 1 month ago

After some ideas from the people on a flutter discord server, I have realized I have rust from dnf installed and apparently that wasn't using the rust from cargo (which i also have installed). After running sudo dnf remove rust it built successfully.