Skip to content

Inconsistent library name creation over operating system #10354

Closed
@Lecrapouille

Description

@Lecrapouille

Problem

I've never developed with Rust, but I'm facing issue with the creation of the library name made by someone else.

Cargo.toml:

[lib]
name = "libstigmark_client"
crate-type = [
    "dylib",        # .dll, .so, .dynlib
    "staticlib"     # .lib, .a
]

Will create in target/debug/ a libstigmark_client.lib for Windows but a liblibstigmark_client.a (same for dynamic lib). So liblib :)

[lib]
name = "stigmark_client"
crate-type = [
   "dylib",        # .dll, .so, .dynlib
   "staticlib"     # .lib, .a
]

Will create stigmark_client.lib for Windows but libstigmark_client.a (same for dynamic lib).

The issue is that when linking with the Python Makefile named Scons it will add -l so the 2nd method is good for Linux but for Windows the 1st method is the good one.

Steps

  1. Standard compilation

Possible Solution(s)

When parsing the library name:

[lib]
name = "libxxx"
  • if libxxx is matched do not add extra lib
  • if xxx is matched then add libxxx

Notes

No response

Version

cargo 1.58.0 (7f08ace4f 2021-11-24)
release: 1.58.0
commit-hash: 7f08ace4f1305de7f3b1b0e2f765911957226bd4
commit-date: 2021-11-24
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1l)
os: Debian 11 (bullseye) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions