Skip to content

More granular SONAME versioning #345

@kpcyrd

Description

@kpcyrd

Related to rustls/rustls-ffi#345 and rustls/rustls-ffi#274.

I've tried to use cargo-c together with Arch Linux packaging tools, which is able to automatically detect and embed the SONAME into package metadata, but noticed I get this:

provides = librustls.so=0-64

After looking into how this works I noticed it's using a string embedded in the .so file:

% readelf -d /usr/lib/librustls.so | rg Lib
 0x000000000000000e (SONAME)             Library soname: [librustls.so.0]

I found the relevant part in the cargo-c codebase:

cargo-c/src/target.rs

Lines 81 to 85 in 0819def

if capi_config.library.versioning {
lines.push(format!("-Wl,-soname,lib{lib_name}.so.{major}"));
} else {
lines.push(format!("-Wl,-soname,lib{lib_name}.so"));
}

There are two things about this:

  1. if the version string is 0.11.0, I think the soname should be librustls.so.0.11
  2. even if the version string is >= 1.0.0, I think it should be possible to configure a major.minor (or even major.minor.patch) SOVER

Specifically with librustls I would like to be able to build it with -Wl,-soname,librustls.so.0.11.0 until the developers are comfortable making ABI commitments. :)

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