繁体   English   中英

MacOS 10.12.6安装Perl模块WWW:Availability.h中的Curl :: Easy错误

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

检查错误,我没有安装/重新安装curl,它默认安装在我的操作系统上

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

尝试使用cpan安装但总是收到该错误我需要帮助我应该怎么做,我没有perl的背景,我只需要运行回归并且该模块是必需的。

这是我第一次安装perl模块,因为它在我的回归文件中是必需的。

所以这不是一件容易的事。 但你可以通过一些修改来构建它。 我还建议安装一个brewer perl而不是使用perl系统

$ brew install perl

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

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

现在从下面的url下载源代码

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

提取并进行两处更改

Curl.c

#include "curlopt-constants.c"

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

然后在Makefile.PL更改

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

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

然后在下载的文件夹中运行make命令

成功

参考

无法安装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

以下对我有用(perl 5,版本28,颠覆0(v5.28.0)为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 (参见: 这个SO答案 ):

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 (参见此票证 ):

From 292c05a8aa9c18bd27d0aaff0b4ee601d9b87b92 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <cpansand@cvrsnica-freebsd-101.herceg.de>
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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM