Skip to content

--output-dir fails if any cdylib exists in the workspace without a .so file #193

@notdanilo

Description

@notdanilo

These lines makes it fail if we have another cdylib crate without a .so file.

cargo-ndk/src/cli/mod.rs

Lines 743 to 753 in 87b29ee

for artifact in artifacts.iter().filter(|a| artifact_is_cdylib(a)) {
let Some(file) = artifact
.filenames
.iter()
.find(|name| name.extension() == Some("so"))
else {
// This should never happen because we filter for cdylib outputs above but you
// never know... and it still feels better than just unwrapping
shell.error("No cdylib file found to copy")?;
std::process::exit(1);
};

It adds two problems:

  1. cargo ndk fails if the host is windows & another cdylib crate exists compiled to .dll
  2. cargo ndk will incorrectly copy .so files if host is linux & another cdylib crate exists with .so compiled to a non-android platform

I could fix this, but I don't know what would be the ideal way to do it without adding a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions