MacOS 10.12.6 Установка модуля Perl WWW: Curl :: Легкая ошибка в Availability.h - PullRequest
3 голосов
/ 10 июля 2019

Проверьте ошибки, Я не установил / переустановил 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, потому что это требуется в моем файле регрессии.

Ответы [ 2 ]

1 голос
/ 14 июля 2019

Для меня сработало следующее (perl 5, версия 28, subversion 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
1 голос
/ 14 июля 2019

Так что это не очень легко. Но вы можете построить его с некоторыми изменениями. Я бы также порекомендовал установить заваренный 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 в загруженной папке

Success

Ссылки

Не удалось установить WWW :: Curl :: Easy: SZBALINT / WWW-Curl-4.17.tar.gz: сделать НЕТ

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

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

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...