Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mk: add .so name versioning, resolves #32 #39

Merged
merged 2 commits into from
Feb 19, 2021
Merged

mk: add .so name versioning, resolves #32 #39

merged 2 commits into from
Feb 19, 2021

Conversation

sreimers
Copy link
Member

@sreimers sreimers commented Nov 9, 2020

@robert-scheck Can you check if soname handling fits your needs/requirements?

@alfredh I saw that you added and reverted a similar change some time ago: creytiv/re@1d19127

Are there any problems I should be aware of or i should test?

@sreimers sreimers added this to the v1.2.0 milestone Nov 10, 2020
@sreimers sreimers marked this pull request as ready for review November 10, 2020 14:48
mk/re.mk Outdated Show resolved Hide resolved
@alfredh
Copy link
Contributor

alfredh commented Nov 10, 2020

after building this branch I get:

$ objdump -p libre.so | grep 'SONAME'
  SONAME               libre.so.11

is it correct that the number after so should be 11 ?

@sreimers
Copy link
Member Author

is it correct that the number after so should be 11 ?

Yes it's currently VER_ABI := $(VER_MAJOR)$(VER_MINOR), but we can start by libre.so.0 and count ABI different.

My thought was a new Feature release, increments ABI too. but we can also specify a stricter ABI compatibility
and setup some tests.

@sreimers sreimers self-assigned this Dec 4, 2020
@sreimers sreimers added enhancement New feature or request and removed enhancement New feature or request labels Dec 4, 2020
@alfredh
Copy link
Contributor

alfredh commented Dec 5, 2020

I am not sure about this PR.

I guess @robert-scheck should test and review it.

I sometimes look at the Opus project for inspiration. Here is similar info
for libopus from Debian 10:

$ dpkg -l | grep libopus0
ii  libopus0:amd64                         1.3-1                               amd64        Opus codec runtime library
ii  libopus0:i386                          1.3-1                               i386         Opus codec runtime library

$ l /usr/lib/x86_64-linux-gnu/libopus.*
-rw-r--r-- 1 root root 701100 Dec 17  2018 /usr/lib/x86_64-linux-gnu/libopus.a
lrwxrwxrwx 1 root root     16 Dec 17  2018 /usr/lib/x86_64-linux-gnu/libopus.so -> libopus.so.0.7.0
lrwxrwxrwx 1 root root     16 Dec 17  2018 /usr/lib/x86_64-linux-gnu/libopus.so.0 -> libopus.so.0.7.0
-rw-r--r-- 1 root root 370600 Dec 17  2018 /usr/lib/x86_64-linux-gnu/libopus.so.0.7.0

$ objdump -p /usr/lib/x86_64-linux-gnu/libopus.so | grep SONAME
  SONAME               libopus.so.0

I dont understand why libopus0 has version 1.3 ...?

perhaps we should also ask @jonassmedegaard from the Debian project for input.

Alfred

@jonassmedegaard
Copy link

The Debian package containing the runtime library has the major part of the SONAME in its package name and has the
upstream opus release version in its package version.

1.3 is version of upstream opus release
1.3-1 is version of Debian package (upstream version + Debian packaging revision)
0.7.0 is SONAME

Hope that helps.

@sreimers
Copy link
Member Author

sreimers commented Dec 8, 2020

I updated the PR to count SONAME ABI Version independent and starting with libre.so.1 (prepared for next release).

@sreimers
Copy link
Member Author

sreimers commented Dec 16, 2020

After some thought and research, I would prefer this versioning:

/usr/lib/libre.so -> libre.so.1.1.0
/usr/lib/libre.so.1 -> libre.so.1.1.0
/usr/lib/libre.so.1.1.0
$ objdump -p /usr/lib/libre.so | grep SONAME
  SONAME               libre.so.1

This corresponds to semantic versioning.
Breaking the ABI/API requires bumping the Major Version.

Sorry for the back and forth. But personally I use Libre only as static cross-platform builds
and had no preference for dynamic builds and soname versioning. Different projects uses
different approaches which is bit confusing, too.

The "/usr/lib/libre.so.1 -> libre.so.1.1.0" linking is done by ldconfig (soname field). As
mentioned here:

https://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

@jonassmedegaard
Copy link

This text seems to decently clarify the distinction between project versions, APIs and ABIs, in case that's a help to some following along here: https://dcreager.net/shared-library-versions/

@sreimers
Copy link
Member Author

sreimers commented Dec 16, 2020

Ok the author suggest to use a separate ABI shared library version info, the math is the following:

This flag accepts an argument of the form ‘current[:revision[:age]]’. So, passing -version-info 3:12:1 sets current to 3, revision to 12, and age to 1.

$major = $current - $age
versuffix=$major.$age.$revision
SOVERSION=$major
Here are a set of rules to help you update your library version information:

- Start with version information of ‘0:0:0’ for each libtool library.
- Update the version information only immediately before a public release of your software. More frequent updates are unnecessary, and only guarantee that the current interface number gets larger faster.
- If the library source code has changed at all since the last update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
- If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
- If any interfaces have been added since the last public release, then increment age.
- If any interfaces have been removed or changed since the last public release, then set age to 0.

The following explanation may help to understand the above rules a bit better: consider that there are three possible kinds of reactions from users of your library to changes in a shared library:

- Programs using the previous version may use the new version as drop-in replacement, and programs using the new version can also work with the previous one. In other words, no recompiling nor relinking is needed. In this case, bump `revision` only, don’t touch `current` nor `age`.
- Programs using the previous version may use the new version as drop-in replacement, but programs using the new version may use APIs not present in the previous one. In other words, a program linking against the new version may fail with “unresolved symbols” if linking against the old version at runtime: set `revision` to 0, bump `current` and `age`.
- Programs may need to be changed, recompiled, and relinked in order to use the new version. Bump `current`, set `revision` and `age` to 0.

https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html

Opus uses the following:

# For libtool.
OPUS_LT_CURRENT=7
OPUS_LT_REVISION=0
OPUS_LT_AGE=7

-version-info @OPUS_LT_CURRENT@:@OPUS_LT_REVISION@:@OPUS_LT_AGE@

@sreimers sreimers merged commit a49396e into master Feb 19, 2021
@sreimers sreimers deleted the soname branch February 19, 2021 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants