Edit this page
Problem
While building the ParaMonte library on a macOS (Darwin) operating system, you may encounter an error of the following nature:
ld: library not found for -lSystem collect2: error: ld returned 1 exit status
This error happens particularly when the GCC Fortran compiler gfortran
is directly called by the ParaMonte library build script install.sh
located in the root directory of the library’s repository on GitHub.
Solution
While CMake is typically capable of finding the require link time libraries, adding the following two lines to the .zshrc
(or .bashrc
) file in the user home directory will resolve the error for all usages on the zsh
(or bash
) command line:
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
If the .zshrc
(or .bashrc
) file does not exist in the user home directory represented by ~
on the command-line, first create the file and then add the above two commands to it, save it, and close it.