perl_inc.diff   [plain text]


--- a/lib/ExtUtils/Embed.pm	2014-01-06 14:46:45.000000000 -0800
+++ b/lib/ExtUtils/Embed.pm	2018-05-11 00:10:36.000000000 -0700
@@ -266,7 +266,7 @@ sub ccdlflags {
 sub perl_inc {
     my $dir = File::Spec->catdir($Config{archlibexp}, 'CORE');
     $dir = qq["$dir"] if $^O eq 'MSWin32';
-    my_return(" -I$dir ");
+    my_return(" -iwithsysroot $dir ");
 }
 
 sub ccopts {
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm	2014-01-06 14:46:43.000000000 -0800
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm	2018-07-26 14:35:27.000000000 -0700
@@ -131,7 +131,7 @@ sub c_o {
     my(@m);
     
     my $command = '$(CCCMD)';
-    my $flags   = '$(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)';
+    my $flags   = '$(CCCDLFLAGS) -iwithsysroot "$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE)';
     
     if (my $cpp = $Config{cpprun}) {
         my $cpp_cmd = $self->const_cccmd;
@@ -439,10 +439,16 @@ MAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})."
 MAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})."
 ";
 
+if ($self->{'PERL_INC'} =~ /^\/System\/Library\/Perl\//) {
+    push @m, q{
+SDKROOT := $(shell xcrun --show-sdk-path)
+PERL_SYSROOT = $(SDKROOT)
+};
+}
 
     push @m, q{
 # Where is the Config information that we are using/depend on
-CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
+CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_SYSROOT)$(PERL_INC)$(DFSEP)config.h
 };
 
 
@@ -938,9 +946,9 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).
 	# platforms.  We peek at lddlflags to see if we need -Wl,-R
 	# or -R to add paths to the run-time library search path.
         if ($Config{'lddlflags'} =~ /-Wl,-R/) {
-            $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -Wl,-R$(PERL_ARCHLIB)/CORE -lperl';
+            $libs .= ' -L$(PERL_SYSROOT)$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -Wl,-R$(PERL_ARCHLIB)/CORE -lperl';
         } elsif ($Config{'lddlflags'} =~ /-R/) {
-            $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -R$(PERL_ARCHLIB)/CORE -lperl';
+            $libs .= ' -L$(PERL_SYSROOT)$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -R$(PERL_ARCHLIB)/CORE -lperl';
         }
     }
 
@@ -3589,7 +3595,7 @@ sub xs_o {	# many makes are too dumb to 
     '
 .xs$(OBJ_EXT):
 	$(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c
-	$(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
+	$(CCCMD) $(CCCDLFLAGS) -iwithsysroot "$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c
 ';
 }
 
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm	2014-01-06 14:46:44.000000000 -0800
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm	2018-07-27 22:45:32.000000000 -0700
@@ -111,7 +111,12 @@ sub object_file {
 
 sub arg_include_dirs {
   my $self = shift;
-  return map {"-I$_"} @_;
+  my @args;
+  foreach (@_) {
+     push (@args, "-iwithsysroot");
+     push (@args, $_);
+  }
+  return @args;
 }
 
 sub arg_nolink { '-c' }