Description: Link libtirpc for the XDR/RPC symbols used by the XTC format
 Since glibc 2.32 the XDR/RPC symbols (xdr_int, xdr_float, xdrstdio_create,
 ...) are no longer provided by libc; they moved to libtirpc.  Find libtirpc
 and link it into the format plugins by adding ${XDR_LIBRARY} to
 target_link_libraries, so that xtcformat.so resolves its xdr_* symbols at
 the correct position (after the object files) on the link command line.
 A plain "-ltirpc" in LDFLAGS did not work because it was placed before the
 object files and dropped by -Wl,--as-needed.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Forwarded: not-needed
Last-Update: 2026-10-23

--- openbabel-3.1.1+dfsg.orig/CMakeLists.txt
+++ openbabel-3.1.1+dfsg/CMakeLists.txt
@@ -220,6 +220,11 @@ check_include_file(rpc/xdr.h    HAVE_RPC
 check_include_file(regex.h      HAVE_REGEX_H)
 check_include_file_cxx(sstream  HAVE_SSTREAM)
 
+# glibc >= 2.32 no longer provides the XDR/RPC symbols; they moved to libtirpc
+if(HAVE_RPC_XDR_H)
+  find_library(XDR_LIBRARY NAMES tirpc)
+endif()
+
 check_symbol_exists(rint          "math.h"     HAVE_RINT)
 check_symbol_exists(snprintf      "stdio.h"    HAVE_SNPRINTF)
 check_symbol_exists(sranddev      "stdlib.h"   HAVE_SRANDDEV)
--- openbabel-3.1.1+dfsg.orig/src/formats/CMakeLists.txt
+++ openbabel-3.1.1+dfsg/src/formats/CMakeLists.txt
@@ -38,7 +38,7 @@ foreach(format ${formats})
   add_library(${format} ${PLUGIN_TYPE} ${format}.cpp
     ${${format}_additional_sources}
     "${openbabel_BINARY_DIR}/include/openbabel/babelconfig.h")
-  target_link_libraries(${format} ${libs} openbabel)
+  target_link_libraries(${format} ${libs} ${XDR_LIBRARY} openbabel)
   install(TARGETS ${format}
                   RUNTIME DESTINATION ${BIN_INSTALL_DIR}
                   LIBRARY DESTINATION ${OB_PLUGIN_INSTALL_DIR}
