Skip Menu |

This queue is for tickets about the threads-shared CPAN distribution.

Report information
The Basics
Id: 120539
Status: resolved
Priority: 0/
Queue: threads-shared

People
Owner: Nobody in particular
Requestors: g.grigelionis [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.57



Subject: Bug #119529 fix breaks builds on macOS Sierra
Date: Tue, 7 Mar 2017 10:12:21 +0100
To: bug-threads-shared [...] rt.cpan.org
From: Gintautas Grigelionis <g.grigelionis [...] gmail.com>
cc -c -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"1.55\" -DXS_VERSION=\"1.55\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" -DHAS_PPPORT_H shared.c shared.xs:660:5: warning: implicit declaration of function 'CLANG_DIAG_IGNORE' is invalid in C99 [-Wimplicit-function-declaration] CLANG_DIAG_IGNORE(-Wthread-safety); ^ shared.xs:660:24: error: use of undeclared identifier 'Wthread' CLANG_DIAG_IGNORE(-Wthread-safety); ^ shared.xs:660:32: error: use of undeclared identifier 'safety' CLANG_DIAG_IGNORE(-Wthread-safety); ^ shared.xs:667:1: error: use of undeclared identifier 'CLANG_DIAG_RESTORE'; did you mean 'CLANG_DIAG_IGNORE'? CLANG_DIAG_RESTORE; ^~~~~~~~~~~~~~~~~~ CLANG_DIAG_IGNORE shared.xs:660:5: note: 'CLANG_DIAG_IGNORE' declared here CLANG_DIAG_IGNORE(-Wthread-safety); ^ shared.xs:667:1: warning: expression result unused [-Wunused-value] CLANG_DIAG_RESTORE; ^~~~~~~~~~~~~~~~~~ 2 warnings and 3 errors generated. make: *** [shared.o] Error 1
I ran into this issue but I think the problem isn't related to your macOS version, but rather the version of Perl you're building against. perl.h added some macros for CLANG_DIAG_* in 5.24, but since they aren't present in earlier versions, trying to build this module with clang against those versions will fail. My quick fix was to check if CLANG_DIAG_IGNORE was defined instead. Patch attached, although I'm sure there's a more elegant solution.
Subject: threads-shared-1.55-clang-diag.patch
From 5a7cca58f921b65dbcfbb83bf32ab76fe63da38b Mon Sep 17 00:00:00 2001 From: Andy Grundman <andyg@activestate.com> Date: Sun, 7 May 2017 15:52:52 -0400 Subject: [PATCH] fix CLANG_DIAG macros when used with older Perls that don't define it --- shared.xs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared.xs b/shared.xs index dab5e36..89a59d4 100644 --- a/shared.xs +++ b/shared.xs @@ -656,14 +656,15 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs) abs -= (NV)ts.tv_sec; ts.tv_nsec = (long)(abs * 1000000000.0); -#if defined(__clang__) || defined(__clang) +#if defined(CLANG_DIAG_IGNORE) CLANG_DIAG_IGNORE(-Wthread-safety); /* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */ #endif switch (pthread_cond_timedwait(cond, mut, &ts)) { -#if defined(__clang__) || defined(__clang) +/* perl.h defines CLANG_DIAG_* but only in 5.24+ */ +#if defined(CLANG_DIAG_RESTORE) CLANG_DIAG_RESTORE; #endif -- 2.11.0 (Apple Git-81)
Thanks for this fix. I have applied it to both threads and threads::shared, pushed to patches to blead, and will release updates to CPAN after acceptance to blean. On 2017-05-07 16:00:59, AGRUNDMA wrote: Show quoted text
> I ran into this issue but I think the problem isn't related to your > macOS version, but rather the version of Perl you're building against. > perl.h added some macros for CLANG_DIAG_* in 5.24, but since they > aren't present in earlier versions, trying to build this module with > clang against those versions will fail. My quick fix was to check if > CLANG_DIAG_IGNORE was defined instead. Patch attached, although I'm > sure there's a more elegant solution.
On 2017-05-07 18:53:28, JDHEDDEN wrote: Show quoted text
> Thanks for this fix. I have applied it to both threads and > threads::shared, pushed to patches to blead, and will release updates > to CPAN after acceptance to blean.
Updates deployed to CPAN. Thanks again.