【问题标题】:Perlbrew - installing Term::ReadLine::Gnu on OS XPerlbrew - 在 OS X 上安装 Term::ReadLine::Gnu
【发布时间】:2014-01-22 22:47:27
【问题描述】:

尝试在 OS X 上安装 Term::ReadLine::Gnumake test 返回错误,例如:

t/00checkver.t .. 1/3 panic: free from wrong pool, 62696c2f62696c!=7f8ed2801200 during global destruction.

搜索后发现一个建议编译 perl 与-DPERL_USE_SAFE_PUTENV。所以,尝试下一个:

perlbrew install perl-5.16.3 --thread --multi --debug -DPERL_USE_SAFE_PUTENV

需要线程,因为Padre 需要它们。不幸的是,重新编译并没有帮助并得到同样的错误。接下来,我发现了这个What is the cause for “panic: free from wrong pool during global destruction.” in Term::ReadLine::Gnu?的问题,而accepted answer建议使用:-Accflags="-DPERL_USE_SAFE_PUTENV"

问题是:

  • 主要是,如何在 OS X 上使用perlbrew 获得工作的 Term::ReadLine::Gnu?
  • 如何编译/安装/切换带有perlbrew 的perl 以获取Padre 的工作perl,需要Term::ReadLine::Gnu

只是想知道:

  • 如果 perl 需要一些“SAFE_PUTENV”来编译一些 CPAN 模块,为什么它不是默认的?为什么有人想要一个无法编译某些 CPAN 模块的 perl?
  • 有人在 OS X 上工作 Padreperlbrew

如果有人需要:

我的 perl 版本

$ perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    osname=darwin, osvers=13.0.0, archname=darwin-thread-multi-2level
    uname='darwin medvedik.local 13.0.0 darwin kernel version 13.0.0: thu sep 19 22:22:27 pdt 2013; root:xnu-2422.1.72~6release_x86_64 x86_64 '
    config_args='-de -Dprefix=/Users/nemo/perl5/perlbrew/perls/perl-5.16.3 -DPERL_USE_SAFE_PUTENV -Dusethreads -DDEBUGGING -Dusemultiplicity -Aeval:scriptdir=/Users/nemo/perl5/perlbrew/perls/perl-5.16.3/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3 -g',
    cppflags='-fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV
                        PERL_TRACK_MEMPOOL 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_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API
  Built under darwin
  Compiled at Jan  5 2014 12:57:57
  %ENV:
    PERLBREW_BASHRC_VERSION="0.67"
    PERLBREW_HOME="/Users/nemo/.perlbrew"
    PERLBREW_MANPATH="/Users/nemo/perl5/perlbrew/perls/perl-5.16.3/man"
    PERLBREW_PATH="/Users/nemo/perl5/perlbrew/bin:/Users/nemo/perl5/perlbrew/perls/perl-5.16.3/bin"
    PERLBREW_PERL="perl-5.16.3"
    PERLBREW_ROOT="/Users/nemo/perl5/perlbrew"
    PERLBREW_VERSION="0.67"
  @INC:
    /Users/nemo/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/darwin-thread-multi-2level
    /Users/nemo/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3
    /Users/nemo/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3/darwin-thread-multi-2level
    /Users/nemo/perl5/perlbrew/perls/perl-5.16.3/lib/5.16.3
    .

来自 t/checkver.t 的输出

$ perl -Mblib t/00checkver.t
1..3
ok 1    loading
ok 2    new
OS: darwin
Perl version: 5.016003

Term::ReadLine::Gnu version: 1.20
GNU Readline Library version: 6.2
ok 3    done
panic: free from wrong pool, 686372612f62696c!=7fd3db000000 during global destruction.

海合会:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

perlbrew

$ perlbrew version
/Users/nemo/perl5/perlbrew/bin/perlbrew  - App::perlbrew/0.67

其他:

  • 将 macports 用于某些库和实用程序。 macports 是自我更新的,所有端口都升级了。

【问题讨论】:

    标签: macos perl macports perlbrew libreadline


    【解决方案1】:

    正如问题中的链接,this answer 中的答案是已经。运行:

     perlbrew install perl-5.16.3 --thread --multi --64all --debug --clang -Accflags="-DPERL_USE_SAFE_PUTENV"
    

    使用此 perl 将成功安装:

    $ cpanm Term::ReadLine::Gnu
    --> Working on Term::ReadLine::Gnu
    Fetching http://www.cpan.org/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.20.tar.gz ... OK
    Configuring Term-ReadLine-Gnu-1.20 ... OK
    Building and testing Term-ReadLine-Gnu-1.20 ... 
    Term::ReadLine::Gnu version: 1.20
    GNU Readline Library version: 6.2
    OK
    Successfully installed Term-ReadLine-Gnu-1.20
    1 distribution installed
    

    在 daxim 的回答中,没有任何地方说 -Accflags 也适用于 perlbrew。确实需要阅读perlbrew help,其中明确说明:

    -D,-U,-A       Switches passed to perl Configure script.
    

    无论如何,仍然不明白为什么对于 OS X 来说-Accflags="-DPERL_USE_SAFE_PUTENV" 不是默认值,但从中吸取了教训:

    对于 OS X,在使用 perlbrew 构建 perl 时,普通用户 应该使用

    perlbrew -Accflags="-DPERL_USE_SAFE_PUTENV"`
    

    获得一个工作的perl

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-09
      • 1970-01-01
      • 2023-03-24
      • 2012-10-30
      • 1970-01-01
      • 1970-01-01
      • 2013-09-13
      • 2013-12-21
      相关资源
      最近更新 更多