Skip to content

Allow configuring name of generated shared library artifact #1970

Open
@xmo-odoo

Description

@xmo-odoo

Currently a library named foo will generate an artifact libfoo.dylib on OSX. That's probably the right default, but it's doubly problematic when building CPython libraries (native modules):

  • CPython's import statement will lookup the shared library's name exactly (ignoring extension) requiring an import libfoo. The lib prefix is very rarely used in Python (the lib suffix somewhat more so, libfoo might also be the postfix to a Python binding to libfoo e.g. python-libfoo). This is compounded by "accelerator" native modules (as replacements or improvements of pure-python ones) normally being prefixed by _: Cargo would generate lib_foo rather than the expecting _foo
  • CPython doesn't look for .dylib files, it apparently only looks for .so files, even in OSX

Being able to provide an exact name for generated library artifacts (maybe platform-wise?) would fix both issues.

I didn't find any way to achieve that via a build script, or the native parameters of cargo build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-scriptsArea: build.rs scriptsA-cargo-targetsArea: selection and definition of targets (lib, bins, examples, tests, benches)A-manifestArea: Cargo.toml issuesC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions