Skip to content

Fix SONAME to include the ABI version suffix - #8

Open
austek wants to merge 1 commit into
espeak-ng:masterfrom
ZirekHQ:fix/soname-versioning-espeak
Open

Fix SONAME to include the ABI version suffix#8
austek wants to merge 1 commit into
espeak-ng:masterfrom
ZirekHQ:fix/soname-versioning-espeak

Conversation

@austek

@austek austek commented Aug 23, 2026

Copy link
Copy Markdown

Fixes #1.

Summary

The shared library's embedded SONAME was passed as -Wl,$(SONAME)$(LIB_NAME) — e.g. plain libsonic.so — while the file actually built and installed is libsonic.so.0.3.0, with libsonic.so.0 as the versioned runtime symlink pointing at it, exactly as reported:

```
$ readelf -aW /usr/lib64/libsonic.so.0 | grep -i SONAME
0x000000000000000e (SONAME) Library soname: [libsonic.so]
```

A correct SONAME must match that runtime symlink (libsonic.so.0), not the unversioned dev symlink (libsonic.so) used only at link time — a mismatched SONAME breaks the usual shared-library upgrade path, since the dynamic linker embeds and looks up the SONAME, not the on-disk filename.

Adds SONAME_SUFFIX (.0, following the LIB_TAG platform-conditional pattern already in this file) rather than changing LIB_NAME itself, since LIB_NAME is also used unversioned elsewhere (the dev symlink, install rules). Empty on Darwin, where SONAME is actually an install_name that already matches the unversioned libsonic.dylib file this Makefile builds there (LIB_TAG is empty on Darwin too) — so Darwin's behavior is unchanged.

Also filed and fixed upstream: waywardgeek/sonic#70 — this repo forked from there and has the identical unqualified -Wl,$(SONAME)$(LIB_NAME) lines.

Test plan

  • readelf -d libsonic.so.0.3.0 | grep -i soname — now libsonic.so.0 (was libsonic.so), matching the reporter's exact repro command
  • readelf -d libsonic_internal.so.0.3.0 | grep -i soname — now libsonic_internal.so.0
  • Full make — succeeds, symlinks (libsonic.so, libsonic.so.0libsonic.so.0.3.0) unchanged

The shared library's embedded SONAME was passed as
-Wl,$(SONAME)$(LIB_NAME) -- e.g. plain "libsonic.so" -- while the file
built and installed is libsonic.so.0.3.0, with libsonic.so.0 as the
versioned runtime symlink pointing at it, as reported:

  $ readelf -aW /usr/lib64/libsonic.so.0 | grep -i SONAME
   0x000000000000000e (SONAME)             Library soname: [libsonic.so]

A correct SONAME must match that runtime symlink (libsonic.so.0), not
the unversioned dev symlink (libsonic.so) used only at link time; a
mismatched SONAME breaks the usual shared-library upgrade path, since
the dynamic linker embeds and looks up the SONAME, not the on-disk
filename.

Verified with readelf -d before/after: SONAME went from "libsonic.so"
to "libsonic.so.0" for both libsonic.so and libsonic_internal.so.

Add SONAME_SUFFIX (".0", following the LIB_TAG platform-conditional
pattern already in this file) rather than changing LIB_NAME itself,
since LIB_NAME is also used unversioned elsewhere (the dev symlink,
install rules). Empty on Darwin, where SONAME is actually an
install_name that already matches the unversioned libsonic.dylib file
this Makefile builds there (LIB_TAG is empty on Darwin too) -- so
Darwin's behavior is unchanged.

Fixes espeak-ng#1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libsonic SONAME is libsonic.so instead of libsonic.so.0

1 participant