中野智文のブログ

データ・マエショリストのメモ

自宅macのJuliaLang環境を治す(2)

nakano-tomofumi.hatenablog.com のつづき。

xcode を入れる。

app store にて。

julia を再インストー

$ brew reinstall julia
Error: You have not agreed to the Xcode license. Please resolve this by running:
  sudo xcodebuild -license accept

とでた。そこで上記のコマンドを実行し、再び julia をインストールするのも失敗。

web の話

Can't load module libopenblas · Issue #76 · staticfloat/homebrew-julia · GitHub

やっぱりこういうのしっかり読むべきだよね。

最後の方に、次を実行しろと書いてある。

brew rm --force gcc gfortran openblas-julia arpack-julia suite-sparse-julia && brew update && brew install julia

R と Julia を既にインストールしてしまっているので、エラーが出たが(--force とは何だったか)、先にそれらを消してから、 再度実行すると、無事インストールされる。

ところが、また同じエラー。

$ brew install --HEAD julia
...
==> make prefix=/usr/local/Cellar/julia/HEAD-bac32d3 USE_BLAS64=0 TAGGED_RELEASE_BANNER="homebrew-julia release" FC=/usr/local/bin/gfortran LLVM_CONFIG=llvm-config-3.7 LLVM_VER=3.7.1 LOCALBASE=/usr/local/Cellar/julia/HEAD-bac32d3 USECLANG=1
Last 15 lines from /Users/nakanotomofumi/Library/Logs/Homebrew/julia/02.make:
            new_enter->setMetadata(LLVMContext::MD_dbg, dbg);
                                   ^~~~~~~~~~~~~
/usr/local/Cellar/llvm37-julia/3.7.1_3/lib/llvm-3.7/include/llvm/IR/DebugLoc.h:23:9: note: forward declaration of 'llvm::LLVMContext'
  class LLVMContext;
        ^
/private/tmp/julia-20170525-4774-rwb8x2/src/llvm-lower-handlers.cpp:218:29: error: incomplete type 'llvm::LLVMContext' named in nested name specifier
            sj->setMetadata(LLVMContext::MD_dbg, dbg);
                            ^~~~~~~~~~~~~
/usr/local/Cellar/llvm37-julia/3.7.1_3/lib/llvm-3.7/include/llvm/IR/DebugLoc.h:23:9: note: forward declaration of 'llvm::LLVMContext'
  class LLVMContext;
        ^
3 errors generated.
make[1]: *** [llvm-lower-handlers.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [julia-src-release] Error 2

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/staticfloat/homebrew-julia/issues

These open issues may also help:
julia quasi-broken after gcc update https://github.com/staticfloat/homebrew-julia/issues/238

うーむ、これもうまくいかない。

よって次のコマンドを実行。

$ brew reinstall --build-from-source openblas-julia

gfortran のコンパイル(gfortran 自身のコンパイルではありませんでした。)でしばらく時間がかかる。おそらく数時間はかかるんじゃないかな。今日はここでおしまい。と思ったらでた。

$ brew reinstall --build-from-source openblas-julia
==> Reinstalling staticfloat/julia/openblas-julia
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading http://github.com/xianyi/OpenBLAS/archive/v0.2.19.tar.gz
==> Downloading from https://codeload.github.com/xianyi/OpenBLAS/tar.gz/v0.2.19
######################################################################## 100.0%
==> make FC=/usr/local/bin/gfortran
==> make PREFIX=/usr/local/Cellar/openblas-julia/0.2.19 install
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because Conflicts with openblas in homebrew-science..

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openblas-julia/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openblas-julia/lib
    CPPFLAGS: -I/usr/local/opt/openblas-julia/include

/usr/local/opt/openblas-julia/bin や、/usr/local/Cellar/openblas-julia/0.2.19/bin には何もないことを確認 ^^;

つづきは、 nakano-tomofumi.hatenablog.com