Source: log4cpp
Version: 1.1.3-1
Severity: important
Tags: patch upstream

log4cpp fails to build from source with glibc 2.31:

| g++ -DHAVE_CONFIG_H -I. -I../include -I../include -I../src  -Wdate-time 
-D_FORTIFY_SOURCE=2  -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-unused 
-pedantic -c -o testDailyRollingFileAppender.o testDailyRollingFileAppender.cpp
| testDailyRollingFileAppender.cpp:43:35: warning: invalid suffix on literal; 
C++11 requires a space between literal and string macro [-Wliteral-suffix]
|    43 | const char* const nesteddirname = "nesteddir"PATHDELIMITER;
|       |                                   ^
| testDailyRollingFileAppender.cpp: In function ‘int 
OnlyManualTesting::jumpToFuture(int)’:
| testDailyRollingFileAppender.cpp:235:7: error: ‘stime’ was not declared in 
this scope; did you mean ‘ctime’?
|   235 |   if (stime(&now) == -1) {
|       |       ^~~~~
|       |       ctime
| make[3]: *** [Makefile:813: testDailyRollingFileAppender.o] Error 1
| make[3]: Leaving directory '/<<PKGBUILDDIR>>/tests'
| make[2]: *** [Makefile:1161: check-am] Error 2
| make[2]: Leaving directory '/<<PKGBUILDDIR>>/tests'
| make[1]: *** [Makefile:555: check-recursive] Error 1
| make[1]: Leaving directory '/<<PKGBUILDDIR>>'
| dh_auto_test: error: make -j1 check VERBOSE=1 returned exit code 2
| make: *** [debian/rules:3: build] Error 25
| dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2

The full build log is available there:
http://qa-logs.debian.net/2020/06/24/log4cpp_1.1.3-1_unstable_glibc-exp.log

The stime function has been marked as obsolete for some time, and since
glibc 2.31 it is no longer available to newly linked binaries. The
clock_settime function should be used instead.

You will find attached a patch fixing that. It would be nice if it can
be fixed relatively soon so that we can start the transition.

Regards,
Aurelien
diff -Nru log4cpp-1.1.3/debian/patches/06-glibc-stime.patch 
log4cpp-1.1.3/debian/patches/06-glibc-stime.patch
--- log4cpp-1.1.3/debian/patches/06-glibc-stime.patch   1970-01-01 
01:00:00.000000000 +0100
+++ log4cpp-1.1.3/debian/patches/06-glibc-stime.patch   2020-07-03 
22:31:02.000000000 +0200
@@ -0,0 +1,15 @@
+The obsolete function stime is no longer available to newly linked binaries
+since glibc 2.31. Replace it by clock_settime.
+
+--- a/tests/testDailyRollingFileAppender.cpp
++++ b/tests/testDailyRollingFileAppender.cpp
+@@ -232,7 +232,8 @@ namespace OnlyManualTesting {
+ 
+               now += seconds;
+ 
+-              if (stime(&now) == -1) {
++              struct timespec ts = { .tv_sec = now };
++              if (clock_settime(CLOCK_REALTIME, &ts) == -1) {
+                       std::cerr << "Can not set date. Need admin privileges?" 
<< std::endl;
+                       return -1;
+               }
diff -Nru log4cpp-1.1.3/debian/patches/series 
log4cpp-1.1.3/debian/patches/series
--- log4cpp-1.1.3/debian/patches/series 2018-05-12 23:29:11.000000000 +0200
+++ log4cpp-1.1.3/debian/patches/series 2020-07-03 22:31:02.000000000 +0200
@@ -2,4 +2,5 @@
 03_aclocal_automake.diff
 04_gcc43.diff
 05_remove_log4cpp_cflags_from_pkgconfig_file.diff
+06-glibc-stime.patch
 fix-abs-call

Reply via email to