Difference between revisions of "Documentation/Nightly/Developers/Fortran"
From Slicer Wiki
(→macOS) Tag: 2017 source edit |
Tag: 2017 source edit |
||
Line 1: | Line 1: | ||
+ | |||
+ | __TOC__ | ||
+ | |||
=== Linux === | === Linux === | ||
Install a fortran compiler with the package manager, like ''gfortran''. | Install a fortran compiler with the package manager, like ''gfortran''. |
Revision as of 15:35, 10 September 2020
Home < Documentation < Nightly < Developers < FortranLinux
Install a fortran compiler with the package manager, like gfortran.
macOS
- Install Miniconda - See https://conda.io/miniconda.html
./Miniconda3-latest-MacOSX-x86_64.sh -p /Volumes/D/Support/miniconda3/ Do you wish the installer to prepend the Miniconda3 install location Answered NO
- To activate of base env.
source /Volumes/D/Support/miniconda3/bin/activate
- Add conda-forge
conda config --add channels conda-forge
-Then create gfortran-env and install gfortran
conda create -n gfortran-env conda activate gfortran-env conda install gfortran_osx-64
- Create cc1 wrapper script to workaround issue https://github.com/NIRALUser/SPHARM-PDM/issues/55:
# # Create gfortran wrapper script to ensure cc1 # fake_bin_dir="fake-bin-to-workaround-cc1-issue" if [[ ! -f /Volumes/D/Support/miniconda3/envs/gfortran-env/bin/gfortran-real ]]; then mv /Volumes/D/Support/miniconda3/envs/gfortran-env/bin/gfortran /Volumes/D/Support/miniconda3/envs/gfortran-env/bin/gfortran-real fi cat << EOF > /Volumes/D/Support/miniconda3/envs/gfortran-env/bin/gfortran #!/usr/bin/env bash script_dir=\$(cd \$(dirname \$0) || exit 1; pwd) export PATH=\$script_dir/../$fake_bin_dir/:\$PATH \$script_dir/gfortran-real "\$@" EOF chmod u+x /Volumes/D/Support/miniconda3/envs/gfortran-env/bin/gfortran # # Create cc1 wrapper script into "fake-bin" directory # mkdir -p /Volumes/D/Support/miniconda3/envs/gfortran-env/$fake_bin_dir cat << EOF > /Volumes/D/Support/miniconda3/envs/gfortran-env/$fake_bin_dir/cc1 #!/usr/bin/env bash # See https://github.com/NIRALUser/SPHARM-PDM/issues/55 # Script adapted from https://github.com/conda-forge/ambertools-feedstock/blob/04e4327e6a3cffdfda36158755ffe00c565fe08c/recipe/fake-bin/cc1 script_dir=\$(cd \$(dirname \$0) || exit 1; pwd) ARGS=() for var in "\$@"; do # Ignore known bad arguments [ "\$var" != '-quiet' ] && ARGS+=("\$var") done \$script_dir/../bin/clang "\${ARGS[@]}" EOF chmod u+x /Volumes/D/Support/miniconda3/envs/gfortran-env/$fake_bin_dir/cc1
Before packaging, we have to fix the installed gfortran libraries with the following script: fix_gfortran_lib_rpath.sh.
The script substitutes @rpath with the needed full paths. Requires atool and install_name_tool.
Windows
- Install Miniconda - See https://scikit-ci-addons.readthedocs.io/en/latest/addons.html#install-miniconda3-4-5-4-ps1
- Install Flang, a fortran compiler targeting llvm: scikit-ci-addons