Subject: | C99 compilation issue with clang |
This version of clang, which comes with OSX Catalina:
```
$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```
Has this compilation error:
```
$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Statistics::EfficiencyCI
Writing MYMETA.yml and MYMETA.json
$ make
cp lib/Statistics/EfficiencyCI.pm blib/lib/Statistics/EfficiencyCI.pm
Running Mkbootstrap for EfficiencyCI ()
chmod 644 "EfficiencyCI.bs"
"/Users/brfraser/perl5/perlbrew/perls/perl-5.28.3/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- EfficiencyCI.bs blib/arch/auto/Statistics/EfficiencyCI/EfficiencyCI.bs 644
"/Users/brfraser/perl5/perlbrew/perls/perl-5.28.3/bin/perl" "/Users/brfraser/perl5/perlbrew/perls/perl-5.28.3/lib/5.28.3/ExtUtils/xsubpp" -typemap '/Users/brfraser/perl5/perlbrew/perls/perl-5.28.3/lib/5.28.3/ExtUtils/typemap' EfficiencyCI.xs > EfficiencyCI.xsc
Please specify prototyping behavior for EfficiencyCI.xs (see perlxs manual)
mv EfficiencyCI.xsc EfficiencyCI.c
cc -c -I. -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -O3 -g -DVERSION=\"0.07\" -DXS_VERSION=\"0.07\" "-I/Users/brfraser/perl5/perlbrew/perls/perl-5.28.3/lib/5.28.3/darwin-2level/CORE" EfficiencyCI.c
EfficiencyCI.xs:24:5: error: implicit declaration of function 'efficiency_ci' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
efficiency_ci(aTHX_ k, N, conflevel, &mode, &low, &high);
^
1 error generated.
make: *** [EfficiencyCI.o] Error 1
```
The attached patch makes EfficiencyCI.xs include `eff_ci.h`, which resolves the above.
Subject: | 0001-Resolve-C99-compilation-issue-by-including-eff_ci.h-.patch |
From 341dca7089302ba3569bd5131d617d4f6abbe6df Mon Sep 17 00:00:00 2001
From: Brian Fraser <brian.fraser@booking.com>
Date: Wed, 23 Sep 2020 23:42:12 +0200
Subject: [PATCH] Resolve C99 compilation issue by including eff_ci.h in the
.xs
---
EfficiencyCI.xs | 1 +
1 file changed, 1 insertion(+)
diff --git a/EfficiencyCI.xs b/EfficiencyCI.xs
index d822711..89d4be0 100644
--- a/EfficiencyCI.xs
+++ b/EfficiencyCI.xs
@@ -7,6 +7,7 @@
#include <float.h>
#include <math.h>
#include "eff_math_fun.h"
+#include "eff_ci.h"
MODULE = Statistics::EfficiencyCI PACKAGE = Statistics::EfficiencyCI
--
2.24.3 (Apple Git-128)