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

No SOVERSION is set in shared library Cmake build #8635

Closed
weichslgartner opened this issue May 20, 2021 · 1 comment · Fixed by #9178 or #9529
Closed

No SOVERSION is set in shared library Cmake build #8635

weichslgartner opened this issue May 20, 2021 · 1 comment · Fixed by #9178 or #9529
Assignees

Comments

@weichslgartner
Copy link

What version of protobuf and what language are you using?
Version: v3.17.0
Language: C++

What operating system (Linux, Windows, ...) and version?
Ubunutu 18.04

What runtime / compiler are you using (e.g., python version or gcc version)
gcc 10.3.0

What did you do?
Build shared library with cmake:

cd cmake && mkdir build && cd build
cmake -Dprotobuf_BUILD_SHARED_LIBS=on ..
make 

What did you expect to see
libprotobuf.so.28.0.0 or libprotobuf.so.28 (or symbolic link to it )

What did you see instead?
libprotobuf.so.3.17.0.0

Anything else we should know about your project / environment
When building with autotools the behavior is as expected:


./autogen.sh
./configure --enable-shared
make

For Cmake, the SOVERSION is not set in libprotobuf.cmake:

set_target_properties(libprotobuf PROPERTIES
    VERSION ${protobuf_VERSION}
    SOVERSION  ${protobuf_SOVERSION} # or the variable where 28 is set; this line is missing
    OUTPUT_NAME ${LIB_PREFIX}protobuf
    DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
add_library(protobuf::libprotobuf ALIAS libprotobuf)
mrjoel added a commit to mrjoel/protobuf that referenced this issue Nov 2, 2021
This updates the CMake support to additionally symlink the soversion value
to the generated shared library when so generated. This aligns the
generated soversion with that traditionally used by the Makefile build
workflow and provides cross-compatibility irrespective of build approach
used.

The primary version of the non-symlink library retains the actual
(non-SO) project version for clarity and compatibility with
installations built using prior versions of CMake support. An example of
the net resulting symlink structures is shown below, where the most
important aspect is that the symlink matching the embedded SONAME is
present (libprotobuf.so.30 in the example case).

Makefile:

    libprotobuf.so -> libprotobuf.so.30.0.0
    libprotobuf.so.30 -> libprotobuf.so.30.0.0
    libprotobuf.so.30.0.0

CMake:

    libprotobuf.so -> libprotobuf.so.30
    libprotobuf.so.30 -> libprotobuf.so.3.19.0.0
    libprotobuf.so.3.19.0.0

Fixes: protocolbuffers#8635
acozzette pushed a commit that referenced this issue Feb 1, 2022
This updates the CMake support to additionally symlink the soversion value
to the generated shared library when so generated. This aligns the
generated soversion with that traditionally used by the Makefile build
workflow and provides cross-compatibility irrespective of build approach
used.

The primary version of the non-symlink library retains the actual
(non-SO) project version for clarity and compatibility with
installations built using prior versions of CMake support. An example of
the net resulting symlink structures is shown below, where the most
important aspect is that the symlink matching the embedded SONAME is
present (libprotobuf.so.30 in the example case).

Makefile:

    libprotobuf.so -> libprotobuf.so.30.0.0
    libprotobuf.so.30 -> libprotobuf.so.30.0.0
    libprotobuf.so.30.0.0

CMake:

    libprotobuf.so -> libprotobuf.so.30
    libprotobuf.so.30 -> libprotobuf.so.3.19.0.0
    libprotobuf.so.3.19.0.0

Fixes: #8635
@Arfrever
Copy link
Contributor

Arfrever commented Feb 4, 2022

Recent commit a9cf69a by @mrjoel added setting of SOVERSION to cmake/libprotobuf.cmake (for libprotobuf.so library), but obviously the same should be done in:

  • cmake/libprotobuf-lite.cmake (for libprotobuf-lite.so library)
  • cmake/libprotoc.cmake (for libprotoc.so library)

Arfrever pushed a commit to Arfrever/protobuf that referenced this issue Feb 18, 2022
…rotocolbuffers#8635)

Soname was set for libprotobuf.so in commit a9cf69a,
but similar changes for libprotobuf-lite.so and libprotoc.so were missed.
Arfrever pushed a commit to Arfrever/protobuf that referenced this issue Feb 18, 2022
Soname was set for libprotobuf.so in commit a9cf69a,
but similar changes for libprotobuf-lite.so and libprotoc.so were missed.

Fixes: protocolbuffers#8635
acozzette pushed a commit that referenced this issue Feb 22, 2022
…9529)

Soname was set for libprotobuf.so in commit a9cf69a,
but similar changes for libprotobuf-lite.so and libprotoc.so were missed.

Fixes: #8635

Co-authored-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@GMail.Com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants