Re: git: 150c90138a5f - main - devel/libfaketime: Update version 0.9.10=>0.9.12

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 23 Aug 2025 16:10:19 UTC
Gerald Pfeifer <gerald_at_pfeifer.com> wrote on
Date: Sat, 23 Aug 2025 06:45:28 UTC :

> On Tue, 19 Aug 2025, Muhammad Moinur Rahman wrote:
> > URL: https://cgit.FreeBSD.org/ports/commit/?id=150c90138a5fc131a5b4afbcb5d309b02997210d
> :
> > devel/libfaketime: Update version 0.9.10=>0.9.12
> > 
> > - Unbreak build on 15. Thanks to arrowd@
> 
> > -BROKEN_FreeBSD_15= ld: error: version script assignment of 'GLIBC_2.2' to symbol 'timer_gettime' failed: symbol not defined
> 
> > +USE_GCC= yes
> 
> Why/how does this unbreak the build on FreeBSD 15?

For a ports tree that still has 0.9.10 , I commented
out the BROKEN_FreeBSD_15 and replicated the problem.
It used the command:

# cc -o faketime -std=gnu99 -fPIC -Wall -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -DPREFIX='"'/usr/local'"' -DLIBDIRNAME='"'/lib/faketime'"' -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   faketime.c   -lpthread -Wl,--version-script=libfaketime.map -lrt
. . . fails . . .

I then instead used the command:

# cc -o faketime -std=gnu99 -fPIC -Wall -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -DPREFIX='"'/usr/local'"' -DLIBDIRNAME='"'/lib/faketime'"' -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   faketime.c   -lpthread -lrt
# 

So simply not having the "-Wl,--version-script=libfaketime.map" avoids
the linking issue. (I've done nothing to test functionality.)

# ldd -a faketime
faketime:
	libthr.so.3 => /lib/libthr.so.3 (0x78328e0a000)
	librt.so.1 => /lib/librt.so.1 (0x7832aac9000)
	libc.so.7 => /lib/libc.so.7 (0x7832b35e000)
/lib/libthr.so.3:
	libc.so.7 => /lib/libc.so.7 (0x7832b35e000)
	libsys.so.7 => /lib/libsys.so.7 (0x783298c9000)
/lib/librt.so.1:
	libthr.so.3 => /lib/libthr.so.3 (0x78328e0a000)
	libc.so.7 => /lib/libc.so.7 (0x7832b35e000)
/lib/libc.so.7:
	libsys.so.7 => /lib/libsys.so.7 (0x783298c9000)
[preloaded]
	[vdso] (0x78328a71000)

For reference:

# cat /wrkdirs/usr/ports/devel/libfaketime/work/libfaketime-da77808/src/libfaketime.map
GLIBC_2.2 {
  global:

  timer_gettime; timer_settime;
  local: timer_settime_*; timer_gettime_*;
};
GLIBC_2.3.3 {
  # Changed timer_t.
  timer_gettime; timer_settime;
} GLIBC_2.2;

That very much looks inappropriate for a FreeBSD context to me:
very GLIBC specific, even GLIBC version specific, which should
not be involved for FreeBSD as far as I can tell. (But, again,
I've done no functional testing.)

> To me this looks like randomly changing things, here to use a different, 
> older compiler, instead of really addressing them.

More like: changed to use a toolchain that supports GLIBC-version
based linking instead of avoiding use of libfaketime.map .

If GLIBC use is required for the result to be functional, that
should be commented on in the Makefile.

> If the software is broken, how is it broken?

The port did not provide a conversion to a fully FreeBSD
context, keeping unneeded GLIBC specifics involved. (But
this wording presumes the result without GLIBC use is
functional.)

> Have you reported it upstream? (If so, please add a pointer to the port.)

I expect that the port should be responsible for avoiding
the "-Wl,--version-script=libfaketime.map".

> If FreeBSD is broken, how is it broken?

FreeBSD is not broken as far as I can tell. I'm not aware of
it claiming support for the GLIBC_2.2 and  GLIBC_2.3.3 usage
in libfaketime.map .

> Have you reported it? (If so, please add a pointer to the port.)
> 
> Generally please describe the issue and its resolution instead of just
> adding USE_GCC=yes so that others can later reproduce and fix (if you 
> don't).
> 
> Gerald
> 
> PS: Why do I care? This is yet another ticking timebomb you are leaving 
> for anyone looking after GCC such as salvadore@ and it blocks progress 
> there.

Other notes:

I've not looked into the macros that override FreeBSD
macro definitions or other warnings. I've only looked
at the linker error issue.

For reference:

In file included from libfaketime.c:55:
./time_ops.h:97:9: warning: 'timespecisset' macro redefined [-Wmacro-redefined]
   97 | #define timespecisset(tvp) timerisset2(tvp,n)
      |         ^
/usr/include/sys/time.h:394:9: note: previous definition is here
  394 | #define timespecisset(tvp)      ((tvp)->tv_sec || (tvp)->tv_nsec)
      |         ^
In file included from libfaketime.c:55:
./time_ops.h:98:9: warning: 'timespecclear' macro redefined [-Wmacro-redefined]
   98 | #define timespecclear(tvp) timerclear2(tvp, n)
      |         ^
/usr/include/sys/time.h:393:9: note: previous definition is here
  393 | #define timespecclear(tvp)      ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
      |         ^
In file included from libfaketime.c:55:
./time_ops.h:99:9: warning: 'timespeccmp' macro redefined [-Wmacro-redefined]
   99 | #define timespeccmp(a, b, CMP) timercmp2(a, b, CMP, n)
      |         ^
/usr/include/sys/time.h:395:9: note: previous definition is here
  395 | #define timespeccmIn file included from libfaketime.c:55:
p(tv./time_ops.hp:, uvp, cmp)              97:        9:                 \
      |         ^warning: 'timespecisset' macro redefined [-Wmacro-redefined]

In file included from libfaketime.c:55:
./time_ops.h:100:9: warning: 'timespecadd' macro redefined [-Wmacro-redefined]
  100 | #define timespecadd(a, b, result) timeradd2(a, b, r   97 | #defiense utlit, n)
m      e| s        ^p
ecisset(t/usr/include/sys/time.hv:p) t400i:m9e:r issnote: etprevious definition is here2(tvp,n)
      | 
        ^
/usr/include/sys/time.h:394:9: note: previous definition is here
  400 | #define timespecadd(tsp, usp, vsp)                                      \
      |         ^
In file included from libfaketime.c:55:
./time_ops.h:101:9: warning: 'timespecsub' macro redefined [-Wmacro-redefined]
  394 | #define timespecisset(tvp)      ((tvp  )101- | #>define ttivmespecsub(a, b_,s erce s|u|l (tvp)->ttv)_ ntsiemcersub2()a,
       b| ,         ^result, 
n)
      |         ^
/usr/include/sys/time.h:409:9: note: previous definition is here
In file included from libfaketime.c:55:
./time_ops.h:98:9: warning: 'timespecclear' macro redefined [-Wmacro-redefined]
  409   98 | #defin | e#define timespecs utbi(mtessppeccle,a ru(stpv,p )vsp)                                       t\i
      |         ^
merclear2(tvp, n)
      |         ^
/usr/include/sys/time.h:393:9: note: previous definition is here
  393 | #define timespecclear(tvp)      ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
      |         ^
In file included from libfaketime.c:55:
./time_ops.h:99:9: warning: 'timespeccmp' macro redefined [-Wmacro-redefined]
   99 | #define timespeccmp(a, b, CMP) timercmp2(a, b, CMP, n)
      |         ^
/usr/include/sys/time.h:395:9: note: previous definition is here
  395 | #define timespeccmp(tvp, uvp, cmp)                                      \
      |         ^
In file included from libfaketime.c:55:
./time_ops.h:100:9: warning: 'timespecadd' macro redefined [-Wmacro-redefined]
  100 | #define timespecadd(a, b, result) timeradd2(a, b, result, n)
      |         ^
/usr/include/sys/time.h:400:9: note: previous definition is here
  400 | #define timespecadd(tsp, usp, vsp)                                      \
      |         ^
In file included from libfaketime.c:55:
./time_ops.h:101:9: warning: 'timespecsub' macro redefined [-Wmacro-redefined]
  101 | #define timespecsub(a, b, result) timersub2(a, b, result, n)
      |         ^
/usr/include/sys/time.h:409:9: note: previous definition is here
  409 | #define timespecsub(tsp, usp, vsp)                                      \
      |         ^
In file included from libfaketime.c:63:
/usr/include/sys/timeb.h:41:2: warning: "this file includes <sys/timeb.h> which is deprecated" [-W#warnings]
   41 | #warning "this file includes <sys/timeb.h> which is deprecated"
      |  ^
libfaketime.c:129:72: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  129 | static int          (*real_stat64)          (int, const char *, struct stat64 *);
      |                                                                        ^
libfaketime.c:130:64: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  130 | static int          (*real_fstat64)         (int, int , struct stat64 *);
      |                                                                ^
libfaketime.c:131:78: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  131 | static int          (*real_fstatat64)       (int, int , const char *, struct stat64 *, int);
      |                                                                              ^
libfaketime.c:132:72: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  132 | static int          (*real_lstat64)         (int, const char *, struct stat64 *);
      |                                                                        ^
In file included from libfaketime.c:63:
/usr/include/sys/timeb.h:41:2: warning: "this file includes <sys/timeb.h> which is deprecated" [-W#warnings]
   41 | #warning "this file includes <sys/timeb.h> which is deprecated"
      |  ^
libfaketime.c:129:72: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  129 | static int          (*real_stat64)          (int, const char *, struct stat64 *);
      |                                                                        ^
libfaketime.c:130:64: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  130 | static int          (*real_fstat64)         (int, int , struct stat64 *);
      |                                                                ^
libfaketime.c:131:78: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  131 | static int          (*real_fstatat64)       (int, int , const char *, struct stat64 *, int);
      |                                                                              ^
libfaketime.c:132:72: warning: declaration of 'struct stat64' will not be visible outside of this function [-Wvisibility]
  132 | static int          (*real_lstat64)         (int, const char *, struct stat64 *);
      |                                                                        ^
libfaketime.c:336:72: warning: while loop has empty body [-Wempty-body]
  336 |   DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_REALTIME, &systime->real));
      |                                                                        ^
libfaketime.c:336:72: note: put the semicolon on a separate line to silence this warning
libfaketime.c:337:72: warning: while loop has empty body [-Wempty-body]
  337 |   DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_MONOTONIC, &systime->mon));
      |                                                                        ^
libfaketime.c:337:72: note: put the semicolon on a separate line to silence this warning
libfaketime.c:336:72: warning: while loop has empty body [-Wempty-body]
  336 |   DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_REALTIME, &systime->real));
      |                                                                        ^
libfaketime.c:336:72: note: put the semicolon on a separate line to silence this warning
libfaketime.c:337:72: warning: while loop has empty body [-Wempty-body]
  337 |   DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_MONOTONIC, &systime->mon));
      |                                                                        ^
libfaketime.c:337:72: note: put the semicolon on a separate line to silence this warning


===
Mark Millard
marklmi at yahoo.com