Re: Help requested: r-bioc-rhdf5lib patches need updating for bioc-3.19 upgrade

Nilesh Patra <[email protected]>
Newsgroups gmane.linux.debian.devel.medical
Organization The Debian Project
Message-ID <6a54xdvwfv7jjyscj5vv3wo7wejr5d7ckr2q7jjc72vx4zi7tc@tax2hb3j2gfo>
On Wed, Jul 10, 2024 at 06:03:26PM +0200, Michael R. Crusoe wrote:
> 
> 
> On 10/07/2024 15.58, Nilesh Patra wrote:
> > On Wed, Jul 10, 2024 at 12:14:05PM +0200, Michael R. Crusoe wrote:
> > > I upgraded r-bioc-rhdf5lib from 1.24.2 to 1.26.0 in the "debian/experimental" branch on salsa.
> > > 
> > > https://salsa.debian.org/r-pkg-team/r-bioc-rhdf5lib/-/tree/debian/experimental?ref_type=heads
> > > 
> > > However when I try to build other packages using the resulting "r-bioc-rhd5lib" binary package, I get the following build errors:
> > > 
> > > # From r-bioc-alabaster.base https://salsa.debian.org/r-pkg-team/r-bioc-alabaster.base
> > > g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-z,relro -o alabaster.base.so RcppExports.o check_csv.o check_list.o choose_numeric_missing_placeholder.o is_rfc3339.o load_csv.o load_list.o validate.o /usr/lib/R/site-library/Rhdf5lib/libs/libhdf5_cpp.a /usr/lib/R/site-library/Rhdf5lib/libs/libhdf5.a -lcrypto -lcurl -lpthread -lsz -lz -ldl -lm -lz -L/usr/lib/R/lib -lR
> > > /usr/bin/ld: cannot find /usr/lib/R/site-library/Rhdf5lib/libs/libhdf5_cpp.a: No such file or directory
> > > /usr/bin/ld: cannot find /usr/lib/R/site-library/Rhdf5lib/libs/libhdf5.a: No such file or directory
> > > collect2: error: ld returned 1 exit status
> > > 
> > > Can I get some help with this?
> > > 
> > > Please push any fixes directly to the "debian/experimental" branch on Salsa and let me know, thank you!
> > 
> > I don't have the time to write a patch/hack around this right now, but I
> > understood what the issue is and it should be relatively easy to fix.
> > 
> > alabaster.base used Rhdf5lib::pkgconfig("PKG_CXX_LIBS") to get the linker flags
> > for Rhdf5 lib as can be see here[1]
> > 
> > This has been set to an incorrect value as per the debian installed package[2].
> > It points to a path that does not exist since we are using hdf5 packaged in
> > debian instead of building and using embedded copies.
> > 
> > Patching the code to point to the correct path should fix the issue for you.
> 
> Thank you, Nilesh, that got me further!
> 
> With https://salsa.debian.org/r-pkg-team/r-bioc-rhdf5lib/-/commit/13333ce8837d34d244f60b4a26469ba378babcb0
> I get
> 
> g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-z,relro -o alabaster.base.so RcppExports.o check_csv.o check_list.o choose_numeric_missing_placeholder.o is_rfc3339.o load_csv.o load_list.o validate.o /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.a /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.a -lcrypto -lcurl -lpthread -lsz -lz -ldl -lm -lz -L/usr/lib/R/lib -lR
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.a(H5Exception.o): warning: relocation against `_ZTVN2H518DataTypeIExceptionE' in read-only section `.text'
> /usr/bin/ld: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.a(H5Exception.o): relocation R_X86_64_PC32 against symbol `_ZTVN2H59ExceptionE' can not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: final link failed: bad value
> collect2: error: ld returned 1 exit status
> make[1]: *** [/usr/share/R/share/make/shlib.mk:10: alabaster.base.so] Error 1

Probably some hdf5 hackery at play here. On re-looking at it, I wonder if itmakes sense to pass in
the paths to libhdf5.a -- maybe not from debian pov? We could likely just rely on -lhdf5.

This patch gets alabaster.base building for me:

--- a/src/Makevars
+++ b/src/Makevars
@@ -1,3 +1,3 @@
-RHDF5_LIBS=$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript" -e 'Rhdf5lib::pkgconfig("PKG_CXX_LIBS")') 
-PKG_CPPFLAGS=-I../inst/include
-PKG_LIBS=$(RHDF5_LIBS) -lz
+RHDF5_LIBS=/usr/lib/R/site-library/Rhdf5lib/libs/Rhdf5lib.so -L/usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/hdf5/serial -lhdf5 -lhdf5_cpp -lcrypto -lcurl -lpthread -lsz
+PKG_CPPFLAGS=-I../inst/include -I/usr/include/hdf5/serial/
+PKG_LIBS=-fPIC $(RHDF5_LIBS) -lz

Best,
Nilesh
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQSglbZu4JAkvuai8HIqJ5BL1yQ+2gUCZo7P5QAKCRAqJ5BL1yQ+
2mEUAP9+FAB3JktOiHbPcTfxyD0GpX1QhoHQCmS5iKZ2nha2vgEAu+IW+w0dBjSd
3iGjDBiLvWYgzBASp1C0wUIkmDqrtwM=
=47SV
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.