From 06824396b2b6c84f3a235cb7c19c2a9701167797 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Thu, 24 Nov 2022 14:52:44 +0200 Subject: Build: Don't put GNU/Linux-specific symbol versions into static liblzma. It not only makes no sense to put symbol versions into a static library but it can also cause breakage. By default Libtool #defines PIC if building a shared library and doesn't define it for static libraries. This is documented in the Libtool manual. It can be overriden using --with-pic or --without-pic. configure.ac detects if --with-pic or --without-pic is used and then gives an error if neither --disable-shared nor --disable-static was used at the same time. Thus, in normal situations it works to build both shared and static library at the same time on GNU/Linux, only --with-pic or --without-pic requires that only one type of library is built. Thanks to John Paul Adrian Glaubitz from Debian for reporting the problem that occurred on ia64: https://www.mail-archive.com/xz-devel@tukaani.org/msg00610.html --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 143a2cbf..5adc3c0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -477,7 +477,10 @@ elseif(BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL "Linux") # because it would put symbol versions into the static library which # can cause problems. It's clearer if all symver related things are # omitted when not building a shared library. - target_compile_definitions(liblzma PRIVATE HAVE_SYMBOL_VERSIONS_LINUX) + # + # NOTE: Set it explicitly to 1 to make it clear that versioning is + # done unconditionally in the C files. + target_compile_definitions(liblzma PRIVATE HAVE_SYMBOL_VERSIONS_LINUX=1) target_link_options(liblzma PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/liblzma/liblzma_linux.map" ) -- cgit v1.2.3