Skip to content

This crate depends on libc, but doesn't declare that dependency #85

Closed
@petrochenkov

Description

@petrochenkov

It refers to atexit in particular.

Unless some other crate pulls libc accidentally you get a linking error like this when using this crate.

[INFO] [stdout]   = note: /usr/bin/ld: /opt/rustwide/target/debug/deps/liblibmimalloc_sys-1551225da21123ef.rlib(static.o): in function `mi_process_load':
[INFO] [stdout]           /opt/rustwide/cargo-home/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/libmimalloc-sys-0.1.26/c_src/mimalloc/src/init.c:533: undefined reference to `atexit'
[INFO] [stdout]           collect2: error: ld returned 1 exit status

This was found when testing some linking order changes in rustc in rust-lang/rust#102832 (comment) (build failure - https://crater-reports.s3.amazonaws.com/pr-102832-1/try%230c94de7c1a8f4b82b92d562847c35f513f520c7a/reg/mimalloc-0.1.30/log.txt).

Activity

thomcc

thomcc commented on Nov 14, 2022

@thomcc
Contributor

Plausibly cc should link libc in when compiling C code (as it does for c++'s stdlib when compiling c++), but I suppose that might break some use cases.

Either way, a patch would probably be welcome here.

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @thomcc@petrochenkov

      Issue actions

        This crate depends on libc, but doesn't declare that dependency · Issue #85 · purpleprotocol/mimalloc_rust