One should not need to set DYLD_FALLBACK_LIBRARY_PATH
in order to use a Fortran compiler in a Conda environment, especially not setting it on a user-wide level via .bash_profile
.
Creating an env with the Conda Forge Fortran compiler stack:
conda create -n foo -c conda-forge fortran-compiler
one can then see on activation that the environment automatically handles updating the appropriate flags to pick up the envs/foo/lib
and envs/foo/include
directories:
(base) $ conda activate foo
(foo) $ env | grep -E "^(FORTRAN|LD)"
LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/mfansler/miniconda3/envs/foo/lib -L/Users/mfansler/miniconda3/envs/foo/lib
LD=x86_64-apple-darwin13.4.0-ld
FORTRANFLAGS=-march=core2 -mtune=haswell -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/mfansler/miniconda3/envs/foo/include
LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs -rpath /Users/mfansler/miniconda3/envs/foo/lib -L/Users/mfansler/miniconda3/envs/foo/lib
For general workflow, I would recommend creating a YAML file that includes all the dependencies you require, e.g.,
fortran-env.yaml
channels:
- conda-forge
- defaults
dependencies:
- fortran-compiler
- zlib # example dependency
Then create an environment from this (conda env create -f fortran-env.yaml
), which you activate when compiling your project.