Skip to content

No detection of changes when library contains hyphens #441

Closed
@ensc

Description

@ensc

When trying to keep nice filenames with hyphens, cargo-c creates both the wanted files and mess from cargo ('-' replaced by '_').

E.g. after

[package.metadata.capi.library]
name = "test-foo"

there will be created (when building from scratch)

libtest-foo.a
libtest-foo.so
libtest_foo.a
libtest_foo.so

When doing changes, only the underscore variants will be rebuilt. Then the hash function calculates the hash function over the requested files (which have not been changed) to see if something changed and exits without regenerating headers.

E.g. content of build directory is (note the dates)

-rw-r--r--. Feb 10 18:52 libtest-foo.a
-rwxr-xr-x. Feb 10 18:52 libtest-foo.so
-rw-r--r--. Feb 10 18:53 libtest_foo.a
-rw-r--r--. Feb 10 18:52 libtest_foo.d
-rwxr-xr-x. Feb 10 18:53 libtest_foo.so

Effect is, that when running cargo cbuild on

#[no_mangle]
pub extern "C" fn add(left: u64, right: u64) -> u64 {
    left + right
}

and changing this later to

#[no_mangle]
pub extern "C" fn sub(left: u64, right: u64) -> u64 {
    left - right
}

the generated wrapper header still contains

uint64_t add(uint64_t left, uint64_t right);

but not sub().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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