Skip to content

cmake: Set the same soname as Makefile.am#168

Merged
iczelia merged 1 commit intoiczelia:masterfrom
iwamatsu:fix-soname
Aug 18, 2025
Merged

cmake: Set the same soname as Makefile.am#168
iczelia merged 1 commit intoiczelia:masterfrom
iwamatsu:fix-soname

Conversation

@iwamatsu
Copy link
Copy Markdown
Contributor

In Makefile.am, soname is set to 1:0:0, but in CMake it is set to 0:0:0. This means that when building with CMake, libraries with different sonames will be built. This will not maintain library compatibility. This sets the same soname in cmake as well.

Before:

$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so  libbzip3.so.0  libbzip3.so.0.0.0
$ objdump -p libbzip3.so
  SONAME               libbzip3.so.0.0.0
$ cd .. && autoreconf -ivf && ./configure && make
$ ls .libs/*.so*
.libs/libbzip3.so .libs/libbzip3.so.1 .libs/libbzip3.so.1.0.0
$ objdump -p ./.libs/libbzip3.so | grep SONAME
  SONAME               libbzip3.so.1

After:

$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so  libbzip3.so.1  libbzip3.so.1.0.0
$ objdump -p libbzip3.so
  SONAME               libbzip3.so.1

In Makefile.am, soname is set to 1:0:0, but in CMake it is set to 0:0:0.
This means that when building with CMake, libraries with different sonames will
be built. This will not maintain library compatibility.
This sets the same soname in cmake as well.

Before:
```
$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so  libbzip3.so.0  libbzip3.so.0.0.0
$ objdump -p libbzip3.so
  SONAME               libbzip3.so.0.0.0
$ cd .. && autoreconf -ivf && ./configure && make
$ ls .libs/*.so*
.libs/libbzip3.so .libs/libbzip3.so.1 .libs/libbzip3.so.1.0.0
$ objdump -p ./.libs/libbzip3.so | grep SONAME
  SONAME               libbzip3.so.1
```

After:
```
$ mkdir t && cd t && cmake .. && make
$ ls *.so*
libbzip3.so  libbzip3.so.1  libbzip3.so.1.0.0
$ objdump -p libbzip3.so
  SONAME               libbzip3.so.1
```

Signed-off-by: Nobuhiro Iwamatsu <[email protected]>
@iczelia
Copy link
Copy Markdown
Owner

iczelia commented Aug 18, 2025

Right, thanks.

@iczelia iczelia merged commit 3ac85a6 into iczelia:master Aug 18, 2025
26 of 34 checks passed
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.

2 participants