Skip to content

Commit

Permalink
Fix broken gfortran in macOS wheel build
Browse files Browse the repository at this point in the history
It appears that gfortran has a somewhat-well-known issue in that it
hard-codes the SDK path that was used to build it, which results in it
falling flat on its face ("ld: library not found for -lm" is especially
popular) if the version of the installed SDK does not match exactly.
While I have never encountered this personally, it appears to affect at
least our Monterey CI machine(s).

Work around this by explicitly setting the SDKROOT to the appropriate
path. (It appears we already do this for Bazel itself, but the macOS
wheel builds need it set when we build dependencies, particularly
MUMPS.)

See also:
OpenMathLib/OpenBLAS#3032 (comment).
  • Loading branch information
mwoehlke-kitware committed Jun 9, 2022
1 parent 165b0ed commit da814cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/wheel/macos/build-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ done < "$resource_root/image/known_hosts"

chmod 600 ~/.ssh/known_hosts

# gfortran hard-codes the path to the SDK with which it was built, which may
# not match the SDK actually on the machine. This can result in the error
# "ld: library not found for -lm", and can be fixed/overridden by setting
# SDKROOT to the appropriate path.
export SDKROOT="$(xcrun --show-sdk-path)"

# -----------------------------------------------------------------------------
# Build Drake's dependencies.
# -----------------------------------------------------------------------------
Expand Down

0 comments on commit da814cb

Please sign in to comment.