New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Time::HiRes broken in blead on darwin #15641
Comments
From @dur-randirCreated by @dur-randirCommit 1c56654 broke Time::HiRes on Perl Info
|
From @dur-randir0001-Time-HiRes-fix-compilation-on-darwin.patchFrom d837a12f49f64a9e671e8e22c2821116c4d70b60 Mon Sep 17 00:00:00 2001
From: Sergey Aleynikov <sergey.aleynikov@gmail.com>
Date: Mon, 3 Oct 2016 00:21:40 +0300
Subject: [PATCH] Time::HiRes: fix compilation on darwin
Commit 1c5665476f0d7250c7d93f82eab2b7cda1e6937f added explicit cast
for one of the clock_gettime() arguments, but darwin lacks clockid_t,
so update emulation layer to match function prototype too.
---
dist/Time-HiRes/HiRes.xs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dist/Time-HiRes/HiRes.xs b/dist/Time-HiRes/HiRes.xs
index 1b9ee23..e7d26f1 100644
--- a/dist/Time-HiRes/HiRes.xs
+++ b/dist/Time-HiRes/HiRes.xs
@@ -803,7 +803,9 @@ static int darwin_time_init() {
}
#ifdef TIME_HIRES_CLOCK_GETTIME_EMULATION
-static int clock_gettime(int clock_id, struct timespec *ts) {
+typedef int clockid_t;
+
+static int clock_gettime(clockid_t clock_id, struct timespec *ts) {
if (darwin_time_init() && timebase_info.denom) {
switch (clock_id) {
case CLOCK_REALTIME:
--
2.10.0
|
From @jkeenanOn Sun Oct 02 14:32:10 2016, randir wrote:
Making this available for smoke-testing in branch: Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @jkeenanOn Sun Oct 02 14:32:10 2016, randir wrote:
For reference, I am attaching the 'make' failure output I got when I attempted to compile on an older Darwin system. The patch (as run in the smoke branch) appears to do no harm on my regular Linux and FreeBSD builds and appears to resolve the build failures on Darwin/PPC and permit 'make test_harness' to complete successfully. However, because the revisions to HiRes.xs proposed in the aptch are not scoped to apply only to Darwin, we should get more testing of, and focus on, the patch before applying. Thank you very much. -- |
From @jkeenanFailure to build Time-HiRes at 1c56654 on Configuration: sh ./Configure -des -Dusedevel ./miniperl -Ilib make_ext.pl lib/auto/Time/HiRes/HiRes.bundle MAKE="make" LIBPERL_A=libperl.a LINKTYPE=dynamic |
From @ilmari"James E Keenan via RT" <perlbug-followup@perl.org> writes:
That's because the typedef is inside the #ifdef TIME_HIRES_CLOCK_GETTIME_EMULATION guard. It needs to go before it, so it's visible to all the emulated
They are, the entire block of code is guarded by the following: /* Until Apple implements clock_gettime() On a tangent, I was wondering if it would make sense to make all the -- |
From @jkeenanOn Tue Oct 04 05:04:12 2016, ilmari wrote:
Could you and Jarkko discuss that, so we can move this ticket to resolution? Thank you very much. |
From @dur-randirHere's an updated patch (in case a non-typemap route is chosen) that should compile and pass on all darwins and that provides POSIX-like prototypes for all emulated functions. I've also noticed that a call to sleep_nanotime() lacks a cast to clockid_t for it's argument - was that intended? |
From @dur-randir0001-Time-HiRes-fix-compilation-on-darwin.patchFrom 06f69371e9a63e53fdf6ca41b1e9a703622be51d Mon Sep 17 00:00:00 2001
From: Sergey Aleynikov <sergey.aleynikov@gmail.com>
Date: Wed, 5 Oct 2016 18:29:34 +0300
Subject: [PATCH] Time::HiRes: fix compilation on darwin
Commit 1c5665476f0d7250c7d93f82eab2b7cda1e6937f added explicit cast
for one of the clock_gettime() arguments, but darwin lacks clockid_t,
so update emulation layer to match function prototype too.
---
dist/Time-HiRes/HiRes.xs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dist/Time-HiRes/HiRes.xs b/dist/Time-HiRes/HiRes.xs
index 1b9ee23..de63b93 100644
--- a/dist/Time-HiRes/HiRes.xs
+++ b/dist/Time-HiRes/HiRes.xs
@@ -802,8 +802,10 @@ static int darwin_time_init() {
return success;
}
+typedef int clockid_t; /* to conform with POSIX prototypes */
+
#ifdef TIME_HIRES_CLOCK_GETTIME_EMULATION
-static int clock_gettime(int clock_id, struct timespec *ts) {
+static int clock_gettime(clockid_t clock_id, struct timespec *ts) {
if (darwin_time_init() && timebase_info.denom) {
switch (clock_id) {
case CLOCK_REALTIME:
@@ -837,7 +839,7 @@ static int clock_gettime(int clock_id, struct timespec *ts) {
#endif /* TIME_HIRES_CLOCK_GETTIME_EMULATION */
#ifdef TIME_HIRES_CLOCK_GETRES_EMULATION
-static int clock_getres(int clock_id, struct timespec *ts) {
+static int clock_getres(clockid_t clock_id, struct timespec *ts) {
if (darwin_time_init() && timebase_info.denom) {
switch (clock_id) {
case CLOCK_REALTIME:
@@ -859,7 +861,7 @@ static int clock_getres(int clock_id, struct timespec *ts) {
#endif /* TIME_HIRES_CLOCK_GETRES_EMULATION */
#ifdef TIME_HIRES_CLOCK_NANOSLEEP_EMULATION
-static int clock_nanosleep(int clock_id, int flags,
+static int clock_nanosleep(clockid_t clock_id, int flags,
const struct timespec *rqtp,
struct timespec *rmtp) {
if (darwin_time_init()) {
--
2.10.0
|
From @jkeenanOn Wed Oct 05 08:41:56 2016, randir wrote:
I have created a *new* smoke-testing branch with Sergey's second submitted patch: smoke-me/jkeenan/aleynikov/2nd-129789-darwin-time-hires -- |
From @arcJames E Keenan via RT <perlbug-followup@perl.org> wrote:
Jim, thanks very much for following up on this ticket and creating that branch. The smoke results for the patch are mixed, but: - The Darwin build failures were because of an unrelated local - The patch does fix the build failures on Darwin for me - There's at least one smoke success for both Linux and Win32, and a I'm therefore merging this patch. Sergey, thanks, applied as d1e7b5a. -- |
From @jkeenanOn Sun Oct 16 04:14:25 2016, arc wrote:
Reported by jarkko on p5p list: ##### cc -c -fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -Wall -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings -O3 -DVERSION=\"1.9740_01\" -DXS_VERSION=\"1.9740_01\" "-I../.." -DTIME_HIRES_NANOSLEEP -DTIME_HIRES_CLOCK_GETTIME -DTIME_HIRES_CLOCK_GETRES -DTIME_HIRES_CLOCK_NANOSLEEP -DTIME_HIRES_CLOCK_NANOSLEEP_EMULATION -DTIME_HIRES_CLOCK -DTIME_HIRES_STAT_ST_XTIMESPEC -DTIME_HIRES_STAT=1 -DATLEASTFIVEOHOHFIVE HiRes.c -- |
This patch was merged to blead in 2016 but the ticket (in RT) was never closed. Is there any reason to keep it open? Thank you very much. |
There's no reason, it can be closed. |
Migrated from rt.perl.org#129789 (status was 'open')
Searchable as RT129789$
The text was updated successfully, but these errors were encountered: