jonathanstowe / TermReadKey

Character mode terminal access for Perl
12 stars 27 forks source link

Can't install on Mac. #39

Open davehodg opened 3 years ago

davehodg commented 3 years ago

On a nearly brand new, up to date mac, Term::ReadKey won't install:

cpanm --reinstall Term::ReadKey

Gives me the following. Why would it not be able to find ReadKey.bundle? It's in /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level/auto/Term/ReadKey/ReadKey.bundle

(% perl -v

This is perl 5, version 30, subversion 2 (v5.30.2) built for darwin-thread-multi-2level (with 2 registered patches, see perl -V for more detail) )

cpanm (App::cpanminus) 1.7044 on perl 5.030002 built for darwin-thread-multi-2level
Work directory is /Users/davez/.cpanm/work/1622207785.43419
You have make /usr/bin/make
You have LWP 6.44
You have /usr/bin/tar: bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6
You have /usr/bin/unzip
Searching Term::ReadKey () on cpanmetadb ...
--> Working on Term::ReadKey
Fetching http://www.cpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.38.tar.gz
-> OK
Unpacking TermReadKey-2.38.tar.gz
Entering TermReadKey-2.38
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.34)
Configuring TermReadKey-2.38
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Term::ReadKey
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.34)
Building and testing TermReadKey-2.38
Running Mkbootstrap for ReadKey ()
chmod 644 "ReadKey.bs"
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- ReadKey.bs blib/arch/auto/Term/ReadKey/ReadKey.bs 644
"/usr/bin/perl" "/System/Library/Perl/5.30/ExtUtils/xsubpp" -noprototypes -typemap '/System/Library/Perl/5.30/ExtUtils/typemap'  ReadKey.xs > ReadKey.xsc
mv ReadKey.xsc ReadKey.c
"/usr/bin/perl" genchars.pl

Writing termio/termios section of cchars.h... Done.
Checking for sgtty...
        Sgtty found.
Checking sgtty...
        tchars structure found.
        ltchars structure found.
Checking symbols
        t_brkc (EOL) found in tchars
        t_dsuspc (DSUSPEND) found in ltchars
        t_eofc (EOF) found in tchars
        t_flushc (DISCARD) found in ltchars
        t_intrc (INTERRUPT) found in tchars
        t_lnextc (QUOTENEXT) found in ltchars
        t_quitc (QUIT) found in tchars
        t_rprntc (REPRINT) found in ltchars
        t_startc (START) found in tchars
        t_stopc (STOP) found in tchars
        t_suspc (SUSPEND) found in ltchars
        t_werasc (ERASEWORD) found in ltchars
Writing sgtty section of cchars.h... Done.
cc -c   -g -pipe -fno-strict-aliasing -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -Os   -DVERSION=\"2.38\" -DXS_VERSION=\"2.38\"  -iwithsysroot "/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE"   ReadKey.c
In file included from ReadKey.xs:7:
./ppport.h:4385:10: warning: 'WIDEST_UTYPE' macro redefined [-Wmacro-redefined]
# define WIDEST_UTYPE U64TYPE
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/handy.h:1073:12: note: previous definition is here
#   define WIDEST_UTYPE U64
           ^
1 warning generated.
rm -f blib/arch/auto/Term/ReadKey/ReadKey.bundle
cc  -bundle -undefined dynamic_lookup -fstack-protector-strong  ReadKey.o  -o blib/arch/auto/Term/ReadKey/ReadKey.bundle  \
              \

chmod 755 blib/arch/auto/Term/ReadKey/ReadKey.bundle
"/usr/bin/perl" "-Iblib/arch" "-Iblib/lib" ReadKey.pm.PL ReadKey.pm
Can't load 'blib/arch/auto/Term/ReadKey/ReadKey.bundle' for module Term::ReadKey: dlopen(blib/arch/auto/Term/ReadKey/ReadKey.bundle, 0x0001): open("", O_RDONLY) failed with errno=2 at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197.
^@ at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 95.
        DynaLoader::croak("Can't load 'blib/arch/auto/Term/ReadKey/ReadKey.bundle' for m"...) called at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197
        DynaLoader::bootstrap("Term::ReadKey") called at ReadKey.pm.PL line 515
Creating ReadKey.pm
Bootstrapping the XS for blockoptions: make: *** [ReadKey.pm] Error 255
-> FAIL Installing Term::ReadKey failed. See /Users/davez/.cpanm/work/1622207785.43419/build.log for details. Retry with --force to force install it.

However, manually doing:

davez@DAVIDs-MBP TermReadKey-2.38 % cc  -bundle -undefined dynamic_lookup -fstack-protector-strong  ReadKey.o  -o blib/arch/auto/Term/ReadKey/ReadKey.bundle
davez@DAVIDs-MBP TermReadKey-2.38 % ls -l blib/arch/auto/Term/ReadKey/ReadKey.bundle
-rwxr-xr-x  1 davez  staff  55072 28 May 14:27 blib/arch/auto/Term/ReadKey/ReadKey.bundle
davez@DAVIDs-MBP TermReadKey-2.38 % "/usr/bin/perl" "-Iblib/arch" "-Iblib/lib" ReadKey.pm.PL ReadKey.pm
Creating ReadKey.pm
Can't load 'blib/arch/auto/Term/ReadKey/ReadKey.bundle' for module Term::ReadKey: dlopen(blib/arch/auto/Term/ReadKey/ReadKey.bundle, 0x0001): open("", O_RDONLY) failed with errno=2 at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197.
 at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 95.
        DynaLoader::croak("Can't load 'blib/arch/auto/Term/ReadKey/ReadKey.bundle' for m"...) called at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197
        DynaLoader::bootstrap("Term::ReadKey") called at ReadKey.pm.PL line 515
Bootstrapping the XS for blockoptions: %                                                                                                                                                                                               
davez@DAVIDs-MBP TermReadKey-2.38 % find . -name \*.bundle
./blib/arch/auto/Term/ReadKey/ReadKey.bundle

But ReadKey.bundle is there! I wonder if I should just brew an old perl to match the one I'm using.

jonathanstowe commented 3 years ago

Yeah that's quite strange, unfortunately I've no way of testing this, but it looks like it's the Dynaloader that's having an issue with whatever is being generated, have you managed to build some other module with an XS part?

davehodg commented 3 years ago

It looks very much like: https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/issues/350