Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I downloaded the latest version of an old project from sourceforge, Vipul's Razor from here: http://razor.sourceforge.net/

The Makefile generated by perl Makefile.PL creates a non-existent target on my platform, MacOS "Big Sur" 11.3.1 . Here is what I tried:

$ perl Makefile.PL
Warning: NAME must be a package name
Writing MYMETA.yml and MYMETA.json
Generating a Unix-style Makefile
Writing Makefile for razor-agents
Writing MYMETA.yml and MYMETA.json
$ make
make: *** No rule to make target `/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/perl.h', needed by `blib/man5/.exists'.  Stop.
$ ls /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/
libperl.dylib
$ uname -a
Darwin macbook.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:41 PDT 2021; root:xnu-7195.101.2~1/RELEASE_ARM64_T8101 arm64

Any ideas? The Makefile is 1000+ lines, but FWIW:

$ grep '/System' Makefile
# These definitions are from config.sh (via /System/Library/Perl/5.30/darwin-thread-multi-2level/Config.pm).
PERL_LIB = /System/Library/Perl/5.30
PERL_ARCHLIB = /System/Library/Perl/5.30/darwin-thread-multi-2level
PERL_ARCHLIBDEP = /System/Library/Perl/5.30/darwin-thread-multi-2level
PERL_INC = /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE
PERL_INCDEP = /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE
MAKEMAKER   = /System/Library/Perl/5.30/ExtUtils/MakeMaker.pm
XSUBPPDIR = /System/Library/Perl/5.30/ExtUtils
XSUBPPDEPS = /System/Library/Perl/5.30/ExtUtils/typemap /System/Library/Perl/5.30/ExtUtils$(DFSEP)xsubpp
XSUBPPARGS = -typemap '/System/Library/Perl/5.30/ExtUtils/typemap'
$(INST_MAN5DIR)/.exists :: /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/perl.h
    @$(EQUALIZE_TIMESTAMP) /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/perl.h $(INST_MAN5DIR)/.exists
MAP_PERLINC   = "-Iblib/arch" "-Iblib/lib" "-I/System/Library/Perl/5.30/darwin-thread-multi-2level" "-I/System/Library/Perl/5.30"

Here is the output of perl -V :

Summary of my perl5 (revision 5 version 30 subversion 2) configuration:
  Platform:
    osname=darwin
    osvers=20.0
    archname=darwin-thread-multi-2level
    uname='darwin bb-g8-pdb106.ta10.sd.apple.com 20.0 darwin kernel version 20.1.0: mon jan 11 10:18:29 pst 2021; root:xnu-7195.41.8.100.5~1development_x86_64 x86_64 '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=cc'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags =' -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV'
    optimize='-Os'
    cppflags='-g -pipe -fno-strict-aliasing -fstack-protector-strong'
    ccversion=''
    gccversion='Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deployment-target-based]'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong'
    libpth=/System/Volumes/Data/SWE/macOS/BuildRoots/2288acc43c/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/usr/local/lib /System/Volumes/Data/SWE/macOS/BuildRoots/2288acc43c/Applications/Xcode.app/Contents/Developer/Toolchains/OSX11.3.xctoolchain/usr/lib/clang/12.0.5/lib /System/Volumes/Data/SWE/macOS/BuildRoots/2288acc43c/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/usr/lib /System/Volumes/Data/SWE/macOS/BuildRoots/2288acc43c/Applications/Xcode.app/Contents/Developer/Toolchains/OSX11.3.xctoolchain/usr/lib /System/Volumes/Data/SWE/macOS/BuildRoots/2288acc43c/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib /usr/local/lib
    libs= 
    perllibs=
    libc=
    so=dylib
    useshrplib=true
    libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=bundle
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags=' -bundle -undefined dynamic_lookup -fstack-protector-strong'
Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_IMPLICIT_CONTEXT
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
    USE_THREAD_SAFE_LOCALE
  Locally applied patches:
    /Library/Perl/Updates/<version> comes before system perl directories
    installprivlib and installarchlib points to the Updates directory
  Built under darwin
  Compiled at Feb 28 2021 03:43:27
  %ENV:
    PERL5LIB="/Users/lucky/perl5/lib/perl5"
    PERL_LOCAL_LIB_ROOT="/Users/lucky/perl5"
    PERL_MB_OPT="--install_base "/Users/lucky/perl5""
    PERL_MM_OPT="INSTALL_BASE=/Users/lucky/perl5"
  @INC:
    /Users/lucky/perl5/lib/perl5/5.30.2/darwin-thread-multi-2level
    /Users/lucky/perl5/lib/perl5/5.30.2
    /Users/lucky/perl5/lib/perl5/darwin-thread-multi-2level
    /Users/lucky/perl5/lib/perl5
    /Library/Perl/5.30/darwin-thread-multi-2level
    /Library/Perl/5.30
    /Network/Library/Perl/5.30/darwin-thread-multi-2level
    /Network/Library/Perl/5.30
    /Library/Perl/Updates/5.30.2
    /System/Library/Perl/5.30/darwin-thread-multi-2level
    /System/Library/Perl/5.30
    /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.30

EDIT #2

I noticed there is no man5 directory under blib. Its a very old release of Vipul's Razor.

$ make
make: *** No rule to make target `/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/perl.h', needed by `blib/man5/.exists'.  Stop.
$ ls blib/man5
ls: blib/man5: No such file or directory

EDIT #3

Håkon Hægland's suggestion below fixed the issue, whilst uncovering the next similar-seeming issue due to the age of the code. It can probably be fixed with similar juggling TBD, but here is the output for posterity:

$ make
cp lib/Razor2/Preproc/deBase64.pm blib/lib/Razor2/Preproc/deBase64.pm
cp lib/Razor2/Client/Agent.pm blib/lib/Razor2/Client/Agent.pm
cp lib/Razor2/Errorhandler.pm blib/lib/Razor2/Errorhandler.pm
cp lib/Razor2/Preproc/deHTML_comment.pm blib/lib/Razor2/Preproc/deHTML_comment.pm
cp lib/Razor2/Logger.pm blib/lib/Razor2/Logger.pm
cp lib/Razor2/Preproc/deHTML.pm blib/lib/Razor2/Preproc/deHTML.pm
cp lib/Razor2/String.pm blib/lib/Razor2/String.pm
cp lib/Razor2/Signature/Ephemeral.pm blib/lib/Razor2/Signature/Ephemeral.pm
cp lib/Razor2/Signature/Whiplash.pm blib/lib/Razor2/Signature/Whiplash.pm
cp lib/Razor2/Preproc/enBase64.pm blib/lib/Razor2/Preproc/enBase64.pm
cp lib/Razor2/Client/Version.pm blib/lib/Razor2/Client/Version.pm
cp lib/Razor2/Preproc/Manager.pm blib/lib/Razor2/Preproc/Manager.pm
cp lib/Razor2/Preproc/deQP.pm blib/lib/Razor2/Preproc/deQP.pm
cp lib/Razor2/Client/Engine.pm blib/lib/Razor2/Client/Engine.pm
cp lib/Razor2/Client/Core.pm blib/lib/Razor2/Client/Core.pm
cp lib/Razor2/Client/Config.pm blib/lib/Razor2/Client/Config.pm
cp lib/Razor2/Syslog.pm blib/lib/Razor2/Syslog.pm
AutoSplitting blib/lib/Razor2/Syslog.pm (blib/lib/auto/Razor2/Syslog)
cp lib/tags blib/lib/tags
cp lib/Razor2/Preproc/deNewline.pm blib/lib/Razor2/Preproc/deNewline.pm
cp lib/Razor2/Engine/VR8.pm blib/lib/Razor2/Engine/VR8.pm
cp deHTMLxs.pm ../blib/lib/Razor2/Preproc/deHTMLxs.pm
AutoSplitting ../blib/lib/Razor2/Preproc/deHTMLxs.pm (../blib/lib/auto/Razor2/Preproc/deHTMLxs)
Running Mkbootstrap for deHTMLxs ()
chmod 644 "deHTMLxs.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- deHTMLxs.bs ../blib/arch/auto/Razor2/Preproc/deHTMLxs/deHTMLxs.bs 644
cc -c   -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -Os   -DVERSION=\"2.18\" -DXS_VERSION=\"2.18\"  "-I/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE"   _deHTMLxs.c
"/usr/bin/perl" "/System/Library/Perl/5.30/ExtUtils/xsubpp"  -typemap '/System/Library/Perl/5.30/ExtUtils/typemap' -typemap '/Users/gmcintire/Downloads/Vipul/razor-agents-2.85/Razor2-Preproc-deHTMLxs/typemap'  deHTMLxs.xs > deHTMLxs.xsc
mv deHTMLxs.xsc deHTMLxs.c
cc -c   -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -Os   -DVERSION=\"2.18\" -DXS_VERSION=\"2.18\"  "-I/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE"   deHTMLxs.c
deHTMLxs.xs:3:10: fatal error: 'EXTERN.h' file not found
#include "EXTERN.h"
         ^~~~~~~~~~
1 error generated.
make[1]: *** [deHTMLxs.o] Error 1
make: *** [subdirs] Error 2

And, FWIW:

$ find / -name EXTERN.h 2>/dev/null 
/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.28/darwin-thread-multi-2level/CORE/EXTERN.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h
                perl.h is part of Perl. But it's only needed when building modules (with a C component). Like with all libraries, it's a common practice of package managers to shunt header files such as these into a separate "devel" package. You apparently have such a package manager, and need to install the remaining files of the perl installation.
– ikegami
                Nov 23, 2021 at 0:03
                "No rule to make target ... CORE/perl.h [does not exists]" : I think the header files in the Perl CORE directory was moved from the standard location to the command line tools SDK directory in macOS 10.14, see Xcode 10 Release Notes. I thought this issue was fixed in ExtUtils::MakeMaker some time ago, see Unable to build on OSX Mojave
– Håkon Hægland
                Nov 23, 2021 at 7:20
                @Lucky ok good! "I have an old Perl project from Sourceforge.." To debug this further: If you provide a link to that project and can install it on my mac and try reproduce the error you got.
– Håkon Hægland
                Nov 23, 2021 at 19:59
                Yes I can reproduce for razor-agents-2.84.tar with the system perl. The module builds fine if I use the perlbrew perl instead
– Håkon Hægland
                Nov 23, 2021 at 20:42

make: *** No rule to make target /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/perl.h, needed by blib/man5/.exists. Stop.

This error is caused by the following line:

$(INST_MAN5DIR)/.exists :: /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/perl.h

in the generated Makefile. On macOS >= 10.14 there is no Perl header files in that location. They was moved to the Xcode command line tools SDK directory at that point see Xcode 10 Release Notes. This was in 2018, so I guess the code you are trying to build is older than that and therefore assumes that the headers are in the old location.

You can patch the Makefile.PL (assuming your project is this one): Change line 81:

my ($perlh) = $self->catfile($Config{archlibexp}, 'CORE', "perl.h");
my $arch_dir = $Config{archlibexp};
if ( $^O eq 'darwin' && 
        ($^X eq '/usr/bin/perl' || $^X eq 'perl') ) {
  my @osvers = split /\./, $Config{osvers};
  if ($osvers[0] >= 18 ) {
      my $sdk_path = `xcrun --show-sdk-path`;
      chomp $sdk_path;
      $arch_dir = $self->catfile( $sdk_path, $arch_dir );
my ($perlh) = $self->catfile($arch_dir, 'CORE', "perl.h");
                Nice, I can confirm this fixes the issue. There are other compilation issues that are uncovered from this but that is probably for similar reasons and could be solved in a similar way. I will update the question above because it doesn't fit in the comment box.
– Lucky
                Nov 29, 2021 at 18:18
                @Lucky "fatal error: 'EXTERN.h' file not found" Interesting :) It works fine on my machine I am on macOS Monterey version 12.0.1. Which version of macOS are you using? I think this could be a bug in the system Perl installation that has been fixed in a later release of macOS..
– Håkon Hægland
                Nov 30, 2021 at 9:31
                From the output you show when compiling deHTMLxs.c namely this: cc -c   -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -Os   -DVERSION=\"2.18\" -DXS_VERSION=\"2.18\"  "-I/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE"   deHTMLxs.c I see that the command is using the option"-I/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE" which is wrong since there are no headers there.
– Håkon Hægland
                Nov 30, 2021 at 9:37
                ... The correct way is to use the compiler flag -iwithsysroot followed by the same path /System/Library/Perl/5.30/darwin-thread-multi-2level/CORE, and this is what my version of ExtUtils::MakeMaker uses. I therefore guess that if you upgrade your macOS version to the same as me 12.0.1 or higher your ExtUtils::MakeMaker module will do the same
– Håkon Hægland
                Nov 30, 2021 at 9:37
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.