Skip to content

Have to make clean everytime I change rust code #21

@tbraun96

Description

@tbraun96

Unfortunately, in order to compile the rust program using cargo make, I must first run cargo make clean. This, of course, adds a long compile-time overhead. This is the error message I get when trying to cargo make without cleaning first:

[cargo-make] INFO - cargo make 0.32.12
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: workspace
[cargo-make][1] INFO - Project: scrap-ffi
[cargo-make][1] INFO - Build File: Makefile.toml
[cargo-make][1] INFO - Task: default
[cargo-make][1] INFO - Profile: development
[cargo-make][1] INFO - Execute Command: "cargo" "fmt"
[cargo-make][1] INFO - Running Task: setup-crate-type
[cargo-make][1] INFO - Running Task: pre-android
[cargo-make][1] INFO - Execute Command: "cargo" "ndk" "--platform" "30" "--target" "aarch64-linux-android" "build"
warning: output filename collision.
The lib target `scrap-ffi` in package `scrap-ffi v0.1.0 (/Users/nologik/satori.net/flutterust/native/scrap-ffi)` has the same output filename as the lib target `scrap-ffi` in package `scrap-ffi v0.1.0 (/Users/nologik/satori.net/flutterust/native/scrap-ffi)`.
Colliding filename is: /Users/nologik/satori.net/flutterust/target/aarch64-linux-android/debug/deps/libscrap_ffi.a
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
warning: output filename collision.
The lib target `scrap-ffi` in package `scrap-ffi v0.1.0 (/Users/nologik/satori.net/flutterust/native/scrap-ffi)` has the same output filename as the lib target `scrap-ffi` in package `scrap-ffi v0.1.0 (/Users/nologik/satori.net/flutterust/native/scrap-ffi)`.
Colliding filename is: /Users/nologik/satori.net/flutterust/target/aarch64-linux-android/debug/libscrap_ffi.a
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
thread 'main' panicked at 'assertion failed: mtimes.insert(output.clone(), mtime).is_none()', src/tools/cargo/src/cargo/core/compiler/fingerprint.rs:996:13
stack backtrace:
   0:        0x1016ca1d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb0278541eabdb65b
   1:        0x1016e9cdc - core::fmt::write::h6eab26c41e1615a6
   2:        0x1016c26b0 - std::io::Write::write_fmt::h53012594e7e61aa3
   3:        0x1016cca70 - std::panicking::default_hook::{{closure}}::h3d38db2d154383b2
   4:        0x1016cc598 - std::panicking::default_hook::hb9d33e9315d46c05
   5:        0x1016cd024 - std::panicking::rust_panic_with_hook::hcf65477e7471a4ca
   6:        0x1016ccbd8 - std::panicking::begin_panic_handler::{{closure}}::h98a6978c37ed787f
   7:        0x1016ca68c - std::sys_common::backtrace::__rust_end_short_backtrace::h989ccc6ff53356f4
   8:        0x1016ccb68 - _rust_begin_unwind
   9:        0x10173d894 - core::panicking::panic_fmt::h72cacefe63e11063
  10:        0x10173d820 - core::panicking::panic::h0416c1ef77139eda
  11:        0x1011d73c4 - cargo::core::compiler::fingerprint::calculate::ha7ebd2e8d5375aa7
  12:        0x1011d1bec - cargo::core::compiler::fingerprint::prepare_target::h9e061c15f1b23525
  13:        0x101326b5c - cargo::core::compiler::compile::h8e1a5b2363291b32
  14:        0x1010adb5c - cargo::core::compiler::context::Context::compile::hf9bb50277194baa7
  15:        0x10128c468 - cargo::ops::cargo_compile::compile_ws::h9ba552f8d250f9be
  16:        0x10128c1e0 - cargo::ops::cargo_compile::compile::h169304b304473a16
  17:        0x101014404 - cargo::commands::build::exec::h99c42455ffd71d1e
  18:        0x10102a340 - cargo::cli::main::h109414b41770b785
  19:        0x10102394c - cargo::main::hb4945485930fa182
  20:        0x10101ce00 - std::sys_common::backtrace::__rust_begin_short_backtrace::h31ccbcc83be8cd7a
  21:        0x10101cfcc - std::rt::lang_start::{{closure}}::h2b1de5896d1ddb85
  22:        0x1016cd46c - std::rt::lang_start_internal::hfcf8d8a4320307b0
  23:        0x1010257a4 - _main
[cargo-make][1] ERROR - Error while executing command, exit code: 101
[cargo-make][1] WARN - Build Failed.
[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

Additionally, between every compile, I need to manually change the cargo.toml. Before compile, crate-type must have both cdylib and staticlib in order to compile:

[lib]
name = "scrap_ffi"
crate-type = ["staticlib", "cdylib"]

After running cargo make, it gets changed to:

[lib]
name = "scrap_ffi"
crate-type = ["staticlib", "staticlib"]

If I forget to change the crate-type back to including cdylib, then compiling fails

Note, as long as I complete the workarounds, the program compiles fine. It's just that there's additional compile-time overhead in having to clean the workspace and resetting the cargo.toml manually each time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions