ExternalLibrary auto-detection fails on M1 macs using homebrew

Issue #2659 resolved
Roland Haas created an issue

With @Leung, Lisa Jing I just dug down a bit into compilation failures using HomeBrew on macOS M1.

There were three errors reported at CST stage by ExternalLibraries;

CST error 1:
 -> Configuration script for thorn LIBJPEG returned exit code 77
   (no error message)
CST error 2:
 -> Configuration script for thorn OPENSSL returned exit code 2
   (no error message)
CST error 3:
 -> Configuration script for thorn ZLIB returned exit code 1
   (no error message)

which turn out to be compilation failures, at least in LIBJPEG’s case. Now libjpeg should not even be attempted to be compiled since the tutorial instructions (which were followed) contain brew install jpeg and indeed jpeg was installed.

It turns out that HomeBrew moved from /usr/local to /opt/homebrew so that the rather limited set of locations checked by many ExternalLibraries no longer match. pkg-config is not help here either it seems.

Part of this is already broken on x86 macs where HomeBrew does not install OpenSSL and zlib into /usr/local but only into its own Cellar hierarchy so that the installed copies are being ignored already on x86 macs (verified on my own x86 macOS VM).

With this we can no longer claim macOS support using homebrew. If similar issues occur using macports then we can no longer claim any macOS support.

Fixes would involve finding out why pkg-config fails and also why compilation attempts fail. Looking at the log files for libjpeg it tried using gcc (ie Apple’s clang-in-disguise) instead of the correct gcc-12 from homebrew. This, unsurprisingly failed. Similarly for OpenSSL (fails due to lack of support of -fopenmp) and similar for zlib.

This will need a M1 owner to step forward as a volunteer to help fix this.

Comments (2)

  1. Roland Haas reporter

    This has been fixed in #2682

    Applied as git hash e6c5d343 "Cactus: search in /opt/hombrew in find_standardlib" of cactus

    Applied as git hash 64f995e "FFTW3: search in HomeBrew installation directory" of ExternalLibraries-FFTW3

    Applied as git hash acf722d "OpenCL: search in HomeBrew installation directory" of ExternalLibraries-OpenCL

    Applied as git hash 2c585f3 "OpenSSL: search in /opt/homebrew for installed packages" of ExternalLibraries-OpenSSL

    Applied as git hash d15d828 "zlib: search in HomeBrew installation directory" of ExternalLibraries-zlib

    Applied as git hash 3fb3343 "hwloc: search in HomeBrew installation directory" of ExternalLibraries-hwloc

    Applied as git hash 554c0bb "pthreads: search in HomeBrew installation directory" of ExternalLibraries-pthreads

  2. Log in to comment