職務の関係上、MacOSX で Fortran を使わなければならなくなったのですが、設定に少し苦労したので備忘録を以下に残します。
Conda
conda create -n fortran -c gfortran_osx-64 gfortran_osx-64
起こった問題
- xcode-select がないと言われたのでインストールした。
-
gfortran hello.f -o hello.exe したあと ./hello.exe したら以下のようなエラーが吐かれた。
dyld: Library not loaded: @rpath/libgfortran.3.dylib
解決手段
理屈は分かってないけど、 https://github.com/ContinuumIO/anaconda-issues/issues/739 を参考に
gfortran hello.f -Wl,-rpath,${CONDA_PREFIX}/lib -o hello.exe
したら動いた。