#940330 libsnappy-dev: objects in libsnappy-shared.a need to be compiled with -fPIC on hppa

Package:
libsnappy-dev
Source:
snappy
Description:
fast compression/decompression library (development files)
Submitter:
John David Anglin
Date:
2021-07-21 23:45:03 UTC
Severity:
normal
#940330#5
Date:
2019-09-15 20:40:43 UTC
From:
To:
Dear Maintainer,

The apitrace package fails to build on hppa with the following error:

[ 99%] Linking CXX shared library egltrace.so
cd /<<PKGBUILDDIR>>/obj-hppa-linux-gnu/wrappers && /usr/bin/cmake -E cmake_link_script CMakeFiles/egltrace.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fvisibility=hidden -std=gnu++11 -Wall -Wno-sign-compare -fno-strict-aliasing -fno-rtti -fno-exceptions -fmessage-length=0 -fno-omit-frame-pointer  -Wl,--version-script=/<<PKGBUILDDIR>>/wrappers/egltrace.version  -static-libgcc -static-libstdc++ -Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,defs -shared -Wl,-soname,egltrace.so -o egltrace.so CMakeFiles/egltrace.dir/egltrace.cpp.o CMakeFiles/egltrace.dir/dlsym.cpp.o libgltrace_common.a ../dispatch/libglproc_egl.a -lpthread -ldl ../helpers/libglhelpers.a libtrace.a ../lib/trace/libcommon.a ../lib/highlight/libhighlight.a ../lib/os/libos.a -lbacktrace ../thirdparty/brotli/libbrotli_dec.a ../thirdparty/brotli/libbrotli_common.a ../lib/guids/libguids.a ../thirdparty/crc32c/libcrc32c.a -Wl,-Bstatic -lsnappy-shared ../dispatch/libglproc.a -Wl,-Bdynamic -ldl
/usr/bin/ld: /usr/lib/gcc/hppa-linux-gnu/9/../../../hppa-linux-gnu/libsnappy-shared.a(snappy.cc.o): relocation R_PARISC_DPREL21L can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: BFD (GNU Binutils for Debian) 2.32.51.20190909 internal error, aborting at ../../bfd/elf32-hppa.c:3954 in elf32_hppa_relocate_section

/usr/bin/ld: Please report this bug.

collect2: error: ld returned 1 exit status

See the following log for full build:
https://buildd.debian.org/status/fetch.php?pkg=apitrace&arch=hppa&ver=8.0%2Brepack-1&stamp=1568579337&raw=0

See the following for latest snappy build:
https://buildd.debian.org/status/fetch.php?pkg=snappy&arch=hppa&ver=1.1.7-1%2Bb1&stamp=1568571052&raw=0

Regards,
Dave Anglin

#940330#10
Date:
2019-09-15 20:52:18 UTC
From:
To:
The symbolic link in the build isn't correct on hppa:

make[1]: Entering directory '/<<PKGBUILDDIR>>'
dh_install
ln -s /usr/lib/hppa-linux-gnu/libsnappy.a \
	/<<PKGBUILDDIR>>/debian/libsnappy-dev/usr/lib/hppa-linux-gnu/libsnappy-shared.a

The objects in libsnappy.a aren't compiled with -fPIC.

Dave

#940330#15
Date:
2019-12-05 14:50:09 UTC
From:
To:
Dear Maintainer,

I hit the same issue. And I found add "POSITION_INDEPENDENT_CODE on" in
CMakelists.txt solves the problem:
```
-SET_TARGET_PROPERTIES(snappy-static PROPERTIES OUTPUT_NAME snappy)
+SET_TARGET_PROPERTIES(snappy-static PROPERTIES POSITION_INDEPENDENT_CODE on OUTPUT_NAME snappy)
```

Best regards,
-Andrew

#940330#20
Date:
2021-07-21 23:34:35 UTC
From:
To:
Suggested patch works on hppa.

Regards,
Dave Anglin