LoginSignup
0

More than 5 years have passed since last update.

Macでperlbrewが正常に利用できない件を調査

Last updated at Posted at 2017-01-27

2017/01/25のMac(OS X 10.12.2)のiTunesのアップデートを適用したあたりからローカル環境での不具合に遭遇。
なんらかの理由で設定が変わった可能性も無きにしもあらずだが、iTunesを怪しんでる。
perl 関連のアップデートはしばらくしていない。

状況

cpancpanmもエラー、sudo cpanは立ち上がる。
なんだこれ? perl -vすら通らないさすがに勘違いっぽい

dyld: lazy symbol binding failed: Symbol not found: _Perl_xs_version_bootcheck
  Referenced from: /Users/*/local/lib/perl5/lib/perl5/darwin-2level/auto/Cwd/Cwd.bundle
  Expected in: dynamic lookup

dyld: Symbol not found: _Perl_xs_version_bootcheck
  Referenced from: /Users/*/local/lib/perl5/lib/perl5/darwin-2level/auto/Cwd/Cwd.bundle
  Expected in: dynamic lookup

*はユーザー名を置換しました

試したこと

  • perlbrew switch 5.18.4 →解決。でも5.10.1を使いたいんだよう…
  • perlbrew uninstall 5.10.1 できる
  • perlbrew install 5.10.1 失敗する
  • perlbrew self-upgrade できる
  • perlbrew patch-perl できる
  • sudo perlbrew install 5.10.1 失敗する
  • perlbrew —-notest install 5.10.1 失敗する
  • 再起動
  • 再びsudo perlbrew install 5.10.1 失敗する
  • sudo rm -r ~/perl5/perlbrew/dists/perl-5.10.1.tar.bz2 成功
  • sudo rm -r ~/perl5/perlbrew/build/perl-5.10.1/ 成功
  • perlbrew install 5.10.1 失敗する
  • perlbrew --notest install 5.10.1 成功する
  • perlbrew switch 5.10.1 成功する
  • perl -v 成功
  • cpan 再び最初のエラーが出る
  • perlbrew install 5.16.3 成功する
  • perlbrew install 5.14.4 失敗する
  • perlbrew --notest install 5.14.4 成功する どうやら5.16.3と5.14.4の間に境界があるっぽい。
  • perlbrew switch 5.14.4 成功する
  • cpanm Jcode
Attempt to reload Scalar/Util.pm aborted.
Compilation failed in require at /Users/*/local/lib/perl5/lib/perl5/File/Temp.pm line 18.
BEGIN failed--compilation aborted at /Users/*/local/lib/perl5/lib/perl5/File/Temp.pm line 18.
Compilation failed in require at /Users/*/perl5/perlbrew/bin/cpanm line 32.
BEGIN failed--compilation aborted at /Users/*/perl5/perlbrew/bin/cpanm line 32.
Compilation failed in require at /Users/*/perl5/perlbrew/bin/cpanm line 499.
BEGIN failed--compilation aborted at /Users/*/perl5/perlbrew/bin/cpanm line 499.

壊れてますね。
- perlbrew switch 5.16.3 成功する
- cpanm Jcode ↑のエラーが出る
- perlbrew switch 5.18.4 成功する
- cpanm Jcode
Jcode is up to date. (2.07)

結論。予めインストールしてあった5.18.4未満ではエラーとなる。

新展開

  • perlbrew install 5.20.3 成功する
  • perlbrew switch 5.20.3 成功する
  • cpanm Jcode 失敗する←イマココ

つまり予めインストールしてあった5.18.4以外ではエラーとなる。

Mac OS X10.12.3の適用

  • 直らんのでdyldなるものの更新を試みる brew install dyld
Error: No available formula with the name "dyld" 
==> Searching for similarly named formulae...
This similarly named formula was found:
dyld-headers

これは怪しい!というわけで
- brew install dyld-headers

==> Using the sandbox
==> Downloading https://opensource.apple.com/tarballs/dyld/dyld-360.18.tar.gz
######################################################################## 100.0%
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    CPPFLAGS: -I/usr/local/opt/dyld-headers/include

==> Summary
🍺  /usr/local/Cellar/dyld-headers/360.18: 9 files, 112.5K, built in 7 seconds

なんか本質を外したっぽい…

  • brew update
  • brew doctor
  • brew reinstall libtool --universal && brew unlink libtool && brew link libtool

進展あり(2017/02/16)

この件諦めて5.18.4使ってたんですけど、全然関係ないところで「お前のlocal::libおかしくね?」と指摘され1local::libの再インストールを試みたところ、エラー。

t/shell.t .............. 48/168 
#   Failed test 'zsh: deactivate PERL5LIB'
#   at t/shell.t line 192.
#          got: '/Users/*/local/lib/perl5/lib/perl5'
#     expected: '/Users/*/local/lib/perl5/lib/perl5:’

んん?シェルの設定なのか?ということでperlbrew initからやり直し。

perlbrew root (~/perl5/perlbrew) is initialized.

Append the following piece of code to the end of your ~/.zshenv and start a
new shell, perlbrew should be up and fully functional from there:

    source ~/perl5/perlbrew/etc/bashrc

Simply run `perlbrew` for usage details.

Happy brewing!

おっしゃる通りにvi zshenvで確認

export PERL_CPANM_OPT="--local-lib=~/local/lib/perl5"
export PERL5LIB=$HOME/local/lib/perl5/lib/perl5:$PERL5LIB;

んん?なんかパスおかしいしsource ~/perl5/perlbrew/etc/bashrcも挿入されていない。

export PERL_CPANM_OPT="--local-lib=~/local/lib/perl5"
export PERL5LIB=$HOME/local/lib/perl5:$PERL5LIB;
source ~/perl5/perlbrew/etc/bashrc

編集してシェルを再起動してcpanm local::lib←成功

これだったんだ!と思ってperlbrew install 5.10.1しかし相変わらず↓

../lib/locale.t                                                (Wstat: 0 Tests: 117 Failed: 1)
  Failed test:  99

zshが悪さしてるわけでもなさげ…

  • chsh でzshからbashに変更。
  • \curl -L https://install.perlbrew.pl | bash成功(zshだと失敗するので前進)
  • vi .bash_profile←設定してあった
  • perlbrew install 5.10.1←変わらず失敗
Test Summary Report
-------------------
../ext/POSIX/t/posix.t                                         (Wstat: 0 Tests: 66 Failed: 0)
  TODO passed:   11
../lib/locale.t                                                (Wstat: 0 Tests: 117 Failed: 1)
  Failed test:  99
Files=1712, Tests=227122, 830 wallclock secs (18.10 usr  6.68 sys + 185.57 cusr 30.96 csys = 241.31 CPU)
Result: FAIL
Failed 1/1712 test programs. 1/227122 subtests failed.
make[2]: *** [_test_tty] Error 255
make[1]: *** [_test] Error 2
make: *** [test_harness] Error 2
perl-5.10.1 is successfully installed.

Failedなのかsuccessfully installedなのか?
perlbrew listすると入ってないので失敗だね。

  • perlbrew install 5.20.3成功した

どっかのバージョンから下がインストールできないという不具合なのかな?
再現する人いませんかね?

TO DO

  • そもそもperlに固有のことなのか調べる(dyldの影響範囲が広そう)
  • 様々なバージョンをinstallしてみる
  • zshでも試してみる。

  1. 大御所なのでビビりました 

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0