[MacPorts] #61486: fluxbox @1.3.7_1 does not compile on macOS Big Sur, Version 11.0.1, because "src/FbTk/FbTime.cc:64:10: error: redefinition of '_mono'"
MacPorts
noreply at macports.org
Mon Nov 16 00:03:51 UTC 2020
#61486: fluxbox @1.3.7_1 does not compile on macOS Big Sur, Version 11.0.1, because
"src/FbTk/FbTime.cc:64:10: error: redefinition of '_mono'"
------------------------+--------------------
Reporter: ballapete | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.6.4
Resolution: | Keywords: bigsur
Port: fluxbox |
------------------------+--------------------
Comment (by ballapete):
`src/FbTk/Font.cc` has:
{{{
28 #ifdef HAVE_CLOCK_GETTIME // linux|*bsd|solaris
29 #include <time.h>
30
31 namespace {
32
33 uint64_t _mono() {
34
35 uint64_t t = 0L;
36 timespec ts;
37
38 if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
39 t = (ts.tv_sec * FbTk::FbTime::IN_SECONDS) + (ts.tv_nsec /
1000L);
40 }
41
42 return t;
43 }
44
45 }
46
47 #endif // HAVE_CLOCK_GETTIME
48
49
50
51
52
53 #ifdef HAVE_MACH_ABSOLUTE_TIME // macosx
54
55 // http://stackoverflow.com/questions/5167269/clock-gettime-
alternative-in-mac-os-x
56 //
https://github.com/ThomasHabets/monotonic_clock/blob/master/src/monotonic_mach.c
57 // http://shiftedbits.org/2008/10/01/mach_absolute_time-on-the-
iphone/
58
59
60 #include <mach/mach_time.h>
61
62 namespace {
63
64 uint64_t _mono() {
65
66 // mach_absolute_time() * info.numer / info.denom yields
67 // nanoseconds.
68
69 static double micro_scale = 0.001; // 1000ms == 1ns
70 static bool initial = true;
71
72 if (initial) {
73 initial = false;
74 mach_timebase_info_data_t info;
75 if (mach_timebase_info(&info) == 0) {
76 micro_scale *= static_cast<double>(info.numer) /
static_cast<double>(info.denom);
77 }
78 }
79
80 return static_cast<uint64_t>(mach_absolute_time() *
micro_scale);
81 }
82
83 }
84
85 #endif // HAVE_MACH_ABSOLUTE_TIME
}}}
`config.log` has both:
{{{
#define HAVE_CLOCK_GETTIME 1
#define HAVE_MACH_ABSOLUTE_TIME 1
}}}
or in `configure`'s output:
{{{
checking for strftime... yes
checking for clock_gettime... yes
checking for clock_gettime in -lrt... no
checking for mach_absolute_time... yes
}}}
`clang` does
{{{
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 110000
}}}
so it's probably best to guard the first or the second function definition
with this because presumingly CLOCK_GETTIME or MACH_ABSOLUTE_TIME has been
introduced in Big Sur.
--
Ticket URL: <https://trac.macports.org/ticket/61486#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list