Package: qt6-base
Tags: patch, ftbfs, hppa
Version: 6.4.2+dfsg

The attached patch fixes this qt6-base "build-from-source" (FTBFS) failure on 
hppa:
/usr/bin/ld: /usr/lib/hppa-linux-gnu/libzstd.a(error_private.o): relocation 
R_PARISC_DPREL21L can not be used when making a shared object; recompile with 
-fPIC

The problem is, that qt6-base suddenly tries to link against the static
library of libzstd.a, while in the past it did linked against the shared 
library:

In current failing build (6.4.2+dfsg-1):
-- Found WrapZSTD: 1.5.2 (found suitable version "1.5.2", minimum required is 
"1.3")
Full log is here:
https://buildd.debian.org/status/fetch.php?pkg=qt6-base&arch=hppa&ver=6.4.2%2Bdfsg-1&stamp=1675198832&raw=0

while it worked in the past for qt6-base 6.4.2+dfsg~rc1-1
-- Found WrapZSTD: /usr/lib/hppa-linux-gnu/libzstd.so (found suitable version "1.5.2", 
minimum required is "1.3")
Full log is here:
https://buildd.debian.org/status/fetch.php?pkg=qt6-base&arch=hppa&ver=6.4.2%2Bdfsg%7Erc1-1&stamp=1672201686&raw=0

The attached patch changes  WrapZSTD to prefer the dynamic library.

Thanks,
Helge
[PATCH] FindWrapZSTD: Prefer libzstd shared library over static library

On some architectures a static library can not be linked into shared library
because shared libraries may need specific symbol relocations.
This fixes the build on hppa architecture which gives those errors: 
/usr/bin/ld: /usr/lib/hppa-linux-gnu/libzstd.a(error_private.o): relocation R_PARISC_DPREL21L can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/hppa-linux-gnu/libzstd.a(zstd_v05.o): relocation R_PARISC_DPREL21L can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/hppa-linux-gnu/libzstd.a(zstd_v06.o): relocation R_PARISC_DPREL21L can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/hppa-linux-gnu/libzstd.a(zstd_v07.o): relocation R_PARISC_DPREL21L can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/hppa-linux-gnu/libzstd.a(huf_decompress.o): relocation R_PARISC_DPREL21L can not be used when making a shared object; recompile with -fPIC

Signed-off-by: Helge Deller <del...@gmx.de>

---
diff -up ./cmake/FindWrapZSTD.cmake.org ./cmake/FindWrapZSTD.cmake
--- ./cmake/FindWrapZSTD.cmake.org	2023-02-04 17:50:29.119361823 +0000
+++ ./cmake/FindWrapZSTD.cmake	2023-02-04 17:51:51.876153609 +0000
@@ -25,10 +25,10 @@ include(FindPackageHandleStandardArgs)
 if(TARGET zstd::libzstd_static OR TARGET zstd::libzstd_shared)
     find_package_handle_standard_args(WrapZSTD
                                       REQUIRED_VARS zstd_VERSION VERSION_VAR zstd_VERSION)
-    if(TARGET zstd::libzstd_static)
-        set(zstdtargetsuffix "_static")
-    else()
+    if(TARGET zstd::libzstd_shared)
         set(zstdtargetsuffix "_shared")
+    else()
+        set(zstdtargetsuffix "_static")
     endif()
     if(NOT TARGET WrapZSTD::WrapZSTD)
         add_library(WrapZSTD::WrapZSTD INTERFACE IMPORTED)

Reply via email to