https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119975
--- Comment #8 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > I did try to do a test for the existence of clock_gettime in > libgcobol/configure.ac. That test is > > # Copied from gcc/configure.ac. 2025-06-05 R.J.Dubner > # At least for glibc, clock_gettime is in librt. But don't pull that > # in if it still doesn't give us the function we want. > ac_cv_func_clock_gettime=no > if test $ac_cv_func_clock_gettime = no; then > AC_CHECK_LIB(rt, clock_gettime, > [LIBS="-lrt $LIBS" > AC_DEFINE(HAVE_CLOCK_GETTIME, 1, > [Define to 1 if you have the `clock_gettime' function.])]) > fi > > and it apparently is coming back with HAVE_CLOCK_GETTIME=1, because of the > errors you are seeing. But, equally apparently, it *shouldn't* be. No, as I mentioned there are three issues here: * In libgcobol.cc (__gg__clock_gettime) you call clock_gettime *without any guard*, which cannot work. * Besides, all your calls to __gg__clock_gettime use CLOCK_REALTIME which is also not available when clock_gettime isn't present. * Also, __gg__clock_gettime has a clockid_t arg, but that type also doesn't exist on systems without clock_gettime. > I need help. Or somebody who knows what they are doing needs to make the > change. For the MacOS environment, I need to know what function I should be > calling (gettimeofday()?), and I need to know a valid way to figure out that > clock_gettime is actually not available when it isn't. gettimeofday should be fine, I guess. You just need to use it consistently... >> There's no clockid_t without clock_gettime. Besides, there are several >> instances of >> >> /vol/gcc/src/hg/master/darwin/libgcobol/intrinsic.cc: In function 'void >> __gg__current_date(cblc_field_t*)': >> /vol/gcc/src/hg/master/darwin/libgcobol/intrinsic.cc:1222:23: error: >> 'CLOCK_REALTIME' was not declared in this scope >> 1222 | __gg__clock_gettime(CLOCK_REALTIME, &tp); // time_t tv_sec; long >> tv_nsec >> | ^~~~~~~~~~~~~~ >> >> which cannot work either. And there's also an unguarded call to >> clock_gettime in __gg__clock_gettime. > > Well, that's just embarrassing. If you look at the code in > __gg__clock_gettime, you'll see that I remove the need to call clock_gettime, > but I neglected to delete the call. Exactly, that's at least part of the problem.