Charles Castillo
Charles Castillo

Reputation: 31

MacOS 10.12.6 Installing Perl Module WWW:Curl::Easy error in Availability.h

Check the errors, I didn't install/reinstall the curl, It is installed by default on my OS

cpan WWW::Curl::Easy


Locating required external dependency bin:curl-config... found at /usr/bin/curl-config.
The version is libcurl 7.54.0
Found curl.h in /usr/include/curl/curl.h
In file included from /usr/include/curl/curl.h:38:
In file included from /usr/include/curl/curlbuild.h:145:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
In file included from /usr/include/inttypes.h:224:
In file included from /usr/include/Availability.h:190:
/usr/include/AvailabilityInternal.h:22938:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12
         ^
/usr/include/AvailabilityInternal.h:22867:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_4
         ^
/usr/include/AvailabilityInternal.h:22800:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_3
         ^
/usr/include/AvailabilityInternal.h:22737:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_2
         ^
/usr/include/AvailabilityInternal.h:22678:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11
         ^
/usr/include/AvailabilityInternal.h:22623:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_3
         ^
/usr/include/AvailabilityInternal.h:22572:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10_2
         ^
/usr/include/AvailabilityInternal.h:22525:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10
         ^
/usr/include/AvailabilityInternal.h:22482:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9
         ^
/usr/include/AvailabilityInternal.h:22443:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8
         ^
/usr/include/AvailabilityInternal.h:22408:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_7
         ^
/usr/include/AvailabilityInternal.h:22377:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6
         ^
/usr/include/AvailabilityInternal.h:22350:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5
         ^
/usr/include/AvailabilityInternal.h:22327:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_4
         ^
/usr/include/AvailabilityInternal.h:22308:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_3
         ^
/usr/include/AvailabilityInternal.h:22293:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_2
         ^
/usr/include/AvailabilityInternal.h:22282:10: error: unterminated conditional directive
        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_1
         ^
/usr/include/AvailabilityInternal.h:30:2: error: unterminated conditional directive
#ifndef __AVAILABILITY_INTERNAL__
 ^
In file included from /usr/include/curl/curl.h:38:
In file included from /usr/include/curl/curlbuild.h:145:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
In file included from /usr/include/inttypes.h:224:
/usr/include/Availability.h:239:2: error: #else without #if
#else
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Building curlopt-constants.c for your libcurl version
Building Easy.pm constants for your libcurl version
Building Share.pm constants for your libcurl version
Checking if your kit is complete...
Looks good
Writing Makefile for WWW::Curl
Writing MYMETA.yml and MYMETA.json
cp lib/WWW/Curl/Easy.pm blib/lib/WWW/Curl/Easy.pm
cp lib/WWW/Curl.pm blib/lib/WWW/Curl.pm
cp lib/WWW/Curl/Form.pm blib/lib/WWW/Curl/Form.pm
cp lib/WWW/Curl/Share.pm blib/lib/WWW/Curl/Share.pm
cp lib/WWW/Curl/Multi.pm blib/lib/WWW/Curl/Multi.pm
/usr/bin/perl "-Iinc" /System/Library/Perl/5.18/ExtUtils/xsubpp  -typemap /System/Library/Perl/5.18/ExtUtils/typemap -typemap typemap  Curl.xs > Curl.xsc && mv Curl.xsc Curl.c
cc -c  -I/usr/include -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os   -DVERSION=\"4.17\" -DXS_VERSION=\"4.17\"  "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE"   Curl.c
In file included from Curl.xs:574:
./curlopt-constants.c:19:58: error: non-void function 'constant' should return a value [-Wreturn-type]
            if (strEQ(name, "DID_MEMORY_FUNC_TYPEDEFS")) return CURL_DID_MEMORY_FUNC_TYPEDEFS;
                                                         ^
./curlopt-constants.c:128:49: error: use of undeclared identifier 'CURL_STRICTER'
            if (strEQ(name, "STRICTER")) return CURL_STRICTER;
                                                ^
./curlopt-constants.c:2051:44: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551599 to -17 [-Wconstant-conversion]
            if (strEQ(name, "ANY")) return CURLAUTH_ANY;
                                    ~~~~~~ ^~~~~~~~~~~~
/usr/include/curl/curl.h:679:32: note: expanded from macro 'CURLAUTH_ANY'
#define CURLAUTH_ANY          (~CURLAUTH_DIGEST_IE)
                               ^~~~~~~~~~~~~~~~~~~
In file included from Curl.xs:574:
./curlopt-constants.c:2052:48: warning: implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551598 to -18 [-Wconstant-conversion]
            if (strEQ(name, "ANYSAFE")) return CURLAUTH_ANYSAFE;
                                        ~~~~~~ ^~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:680:32: note: expanded from macro 'CURLAUTH_ANYSAFE'
#define CURLAUTH_ANYSAFE      (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
make: *** [Curl.o] Error 1
  SZBALINT/WWW-Curl-4.17.tar.gz
  /usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

Tried using cpan install but always receive that error I need help on what should I do, I don't have background in perl, I just need to run the regression and that module is required.

This is my first time to install a perl module because it is required in my regression file.

Upvotes: 3

Views: 758

Answers (2)

Håkon Hægland
Håkon Hægland

Reputation: 40748

The following worked for me (perl 5, version 28, subversion 0 (v5.28.0) built for darwin-thread-multi-2level, XCode 9.4.1):

wget https://www.cpan.org/modules/by-module/WWW/WWW-Curl-4.17.tar.gz
tar zxvf WWW-Curl-4.17.tar.gz
cd WWW-Curl-4.17
cpan Module::Install
git apply cpp.patch
git apply stretch.patch
perl Makefile.PL
make
make install

cpp.patch (see: this SO answer):

diff --git a/Makefile.PL b/Makefile.PL
index f9170bb..124e5fd 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -100,7 +100,7 @@ if (!defined($curl_h)) {
      print "Found curl.h in $curl_h\n";
      my @syms;
      my $has_cpp = 0;
-     open(H_IN, "-|", "cpp", $curl_h) and $has_cpp++;
+     open(H_IN, "-|", "cc -E", $curl_h) and $has_cpp++;
      unless ($has_cpp) {
          warn "No working cpp ($!).  Parsing curl.h in Perl";
          open(H_IN, "<", $curl_h) or die("Can't open curl.h at path $curl_h, because: ".$!);

stretch.patch (see this ticket):

From 292c05a8aa9c18bd27d0aaff0b4ee601d9b87b92 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <[email protected]>
Date: Sun, 16 Apr 2017 22:17:00 +0200
Subject: [PATCH] compilation fixes for curl 7.50.2 and newer (RT #117793)

---
 Makefile.PL | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.PL b/Makefile.PL
index f9170bb..bb852e4 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -127,7 +127,7 @@ if (!defined($curl_h)) {
     close H;

     for my $e (sort @syms) {
-       if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
+       if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|^CURL_DID_MEMORY_FUNC_TYPEDEFS\z|_LAST\z|_LASTENTRY\z)/) {
           next;
        }
        my ($group) = $e =~ m/^([^_]+_)/;
-- 
2.1.2

Upvotes: 1

Tarun Lalwani
Tarun Lalwani

Reputation: 146510

So it is not a very easy. But you can build it with some modification. I would also recommend installing a brewed perl instead of using the system perl

$ brew install perl

# Update the CPAN to latest
$ perl -MCPAN -e 'install Bundle::CPAN'

# Install Installer paackage
$ perl -MCPAN -e 'install Module::Install'

Now download the source code from below url

https://cpan.metacpan.org/authors/id/S/SZ/SZBALINT/WWW-Curl-4.17.tar.gz

Extract and it make two changes

Curl.c

#include "curlopt-constants.c"

to

#undef CURL_DID_MEMORY_FUNC_TYPEDEFS
#define CURL_DID_MEMORY_FUNC_TYPEDEFS 0
#include "curlopt-constants.c"

And then in Makefile.PL change

if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {

to

if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|_LAST\z|_LASTENTRY\z)/) {

And then run the make command in the downloaded folder

Success

References

Failed to install WWW::Curl::Easy: SZBALINT/WWW-Curl-4.17.tar.gz : make NO

https://www.perlmonks.org/?node_id=1208670

https://www.perlmonks.org/?node_id=1208666

Upvotes: 1

Related Questions