Skip to content

Please bump SONAME following API breakage #333

@hosiet

Description

@hosiet

Hi,

I was working on packaging zxing-cpp in Debian/Ubuntu. As I read in https://github.com/nu-book/zxing-cpp/releases/tag/v1.3.0 , v1.3.0 introduces API breakage by removing deprecated APIs. Essentially we should bump library SONAME to avoid older binaries that dynamically linked to libzxing.so.1 from crashing due to missing symbols. Ideally this should be done before each version release that introduces API/ABI breakage.

May I suggest decoupling SONAME with {PROJECT_VERSION_MAJOR} and bump SONAME to 2, given that we are obviously not following semver? The following patch should do the job. Let me know if you prefer me to submit a Pull Request instead.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
 cmake_minimum_required (VERSION 3.14)
 
 project (ZXing VERSION "1.3.0" LANGUAGES CXX)
+set (ZXING_SONAME 2)
 
 option (BUILD_WRITERS "Build with writer support (encoders)" ON)
 option (BUILD_READERS "Build with reader support (decoders)" ON)
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index 0d4bff9..a9cf460 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -455,7 +455,7 @@ set_target_properties(ZXing PROPERTIES EXPORT_NAME ZXing)
 set_target_properties(ZXing PROPERTIES POSITION_INDEPENDENT_CODE ON)
 if (PROJECT_VERSION)
     set_target_properties(ZXing PROPERTIES VERSION ${PROJECT_VERSION})
-    set_target_properties(ZXing PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
+    set_target_properties(ZXing PROPERTIES SOVERSION ${ZXING_SONAME})
 endif()
 
 include (GNUInstallDirs)

This would greatly help downstream Linux distributions to track library API/ABI changes, and ensure that consumers of zxing-cpp would transition to a new library version seamlessly.

Please let me know if you have any questions or concerns. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions