Skip to content

Commit

Permalink
Set macOS LIBRARY_PATH for Homebrew
Browse files Browse the repository at this point in the history
Per the macOS ld(1) man page <https://www.unix.com/man-page/OSX/1/ld/>,

> The default library search path is /usr/lib then /usr/local/lib.

When `HOMEBREW_PREFIX=/usr/local`, this is where the `.dylib` files for
X11 are symlinked by Homebrew.

When `AC_PATH_XTRA` is called, it uses `/usr/bin/gcc` (Apple clang) and
since the libraries are found in `/usr/local/lib`, it does not need to
specify any `-L` paths.

However when `libtool` is used to call Homebrew `gfortran`, it sets
the flag `-syslibroot` which per the man page for ld(1):

> The -syslibroot option will prepend a prefix to all search paths.

and this means that it no longer looks under `/usr/local/lib` by
default. To fix this, add the default path back by setting the
`LIBRARY_PATH` environment variable.
  • Loading branch information
zmughal committed Jan 5, 2022
1 parent bb4bc01 commit 98f1723
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
brew install automake \
libpng \
libxt
echo "LIBRARY_PATH=$(brew --prefix)/lib${LIBRARY_PATH:+:${LIBRARY_PATH}}" >> $GITHUB_ENV
- name: Bootstrap
run: |
sh ./bootstrap
Expand Down

0 comments on commit 98f1723

Please # to comment.