On CentOS 5 and Solaris 10, I get build errors.

* On CentOS 5:

  CCLD     src/sort
lib/libcoreutils.a(libcoreutils_a-tempname.o): In function `random_bits':
/home/bruno/coreutils-9.3.147-d553ab/build-64/../lib/tempname.c:111: undefined 
reference to `clock_gettime'
collect2: ld returned 1 exit status
make[2]: *** [src/sort] Error 1

  CCLD     src/split
lib/libcoreutils.a(libcoreutils_a-tempname.o): In function `random_bits':
/home/bruno/coreutils-9.3.147-d553ab/build-64/../lib/tempname.c:111: undefined 
reference to `clock_gettime'
collect2: ld returned 1 exit status
make[2]: *** [src/split] Error 1

* On Solaris 10: Likewise, but only for 'split', not for 'sort'.

  CCLD     src/split
Undefined                       first referenced
 symbol                             in file
clock_gettime                       
lib/libcoreutils.a(libcoreutils_a-tempname.o)
ld: fatal: symbol referencing errors. No output written to src/split
collect2: error: ld returned 1 exit status

This comes from the Gnulib 'tempname' module, which requires linking
with $(CLOCK_TIME_LIB), since 2020-11-16.

This patch fixes it.


>From ee07eea582ccaeaa72928f335beac2bc6baa5f31 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 27 Aug 2023 01:10:13 +0200
Subject: [PATCH] maint: Fix link errors of sort, split on CentOS 5 and Solaris
 10

* src/local.mk (src_sort_LDADD, src_split_LDADD): Add $(CLOCK_TIME_LIB).
---
 src/local.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/local.mk b/src/local.mk
index 4d7df2789..549014181 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -260,6 +260,8 @@ src_ln_LDADD += $(CLOCK_TIME_LIB)
 src_ls_LDADD += $(CLOCK_TIME_LIB)
 src_mktemp_LDADD += $(CLOCK_TIME_LIB)
 src_pr_LDADD += $(CLOCK_TIME_LIB)
+src_sort_LDADD += $(CLOCK_TIME_LIB)
+src_split_LDADD += $(CLOCK_TIME_LIB)
 src_tac_LDADD += $(CLOCK_TIME_LIB)
 src_timeout_LDADD += $(LIB_TIMER_TIME)
 src_touch_LDADD += $(CLOCK_TIME_LIB)
-- 
2.34.1

Reply via email to