Repository navigation
Support Apple Clang OpenMP with upstream libtool - #49
Conversation
the biggish changes are 1) m4/m4_ax_openmp.m4 - which is replacing ax_openmp.m4 with a patched mainline (autoconf 2.72) AC_OPENMP - still named AX_OPENMP - to understand "-Xpreprocessor -fopenmp" Apple clang flags. The advantage is that it's just better in the way of support and cleanup of the mess left from testing flags. 2) build-aux/ltmain.sh.in - modified libtool sources to include the upstream commit https://cgit.git.savannah.gnu.org/cgit/libtool.git/commit/?id=c9c59804175920990ae2dc9706fa23a2cd4717b0 The rest is small and needed to explicitly pass -lomp flag to the linker (this is llvm's libomp, not to be confused with incompatible GNU libgomp) and generate libtool from the included source. On Homebrew this can be tested by brew install libomp export CPATH=`brew --prefix`/opt/libomp/include export LIBRARY_PATH=`brew --prefix`/opt/libomp/lib ./configure --enable-openmp [etc]
|
there are a couple of issues here.
I don't know how to fix this easily. I guess a full-blown installation of libtool from source prior to building m4ri would do, but that's a bit of work for not too much gain. I'll see if this is feasible on the CI.
|
|
OK, the CI works now. It's a big ugly, but, well... |
| sudo DEBIAN_FRONTEND=noninteractive apt-get install autoconf automake libtool | ||
| sudo DEBIAN_FRONTEND=noninteractive apt-get install autoconf automake | ||
| cd /tmp | ||
| wget https://ftpmirror.gnu.org/libtool/libtool-2.5.4.tar.gz |
There was a problem hiding this comment.
I don't like this at all, this is asking for trouble. We shouldn't force a new libtool on Linux testing for OSX.
There was a problem hiding this comment.
we should not be held hostage by GitHub not updating their runners :-)
|
Well, libtool 2.5.4 has been released in Nov 2024. It's of course not new that Debian/Ubuntu is asleep at the wheel, along with GNU in general. Other major build systems such as cmake and meson support this sort of flags without any problems. And for a good reason - they are crucial to build code which loads tasks on GPUs.! |
|
besides, it does not matter for configured tarballs, one can |
|
I sympathise but I can't commit to maintaining code where the CI runs some hardcoded libtool version. Sorry. |
|
I can propose the following hack - detect the system libtool version in configure, and use it to fill the template in Would you accept this? |
|
I'm not actively ignoring this, just got a bunch on. |
|
in case, libtool 2.6.1, with the needed fix, will be out in a month or two. Hopefully it can make it into Homebrew at some point. Meanwhile, m4ri is a formula in Homebrew (not using OpenMP, they don't like patches to upstream packages). I'll submit m4rie to Homebrew this week. |
|
How does libtool 2.6.1 change this PR? Would it become redundant or would it need to be changed? |
|
with libtool 2.6.1, what's left here would be start using OpenMP in CI: |
|
okay cool, let's wait :) |
|
Thanks! Looks like even Debian Stable ships AC >= 2.71: https://packages.debian.org/trixie/autoconf |
Apple Clang needs
-Xpreprocessor -fopenmpto compile OpenMP code and-lompto link LLVM’s OpenMP runtime. UpdateAX_OPENMPdetection and propagate the compiler and linker flags to the library, tests, and pkg-config metadata.Use the normal libtool bootstrap process instead of carrying a patched
build-aux/ltmain.sh.in. GNU Libtool 2.6.2 includes the upstream fix for Apple Clang’s two-token OpenMP flag. Configure reports a clear error if these flags are selected but the build machinery was generated with older libtool; other configurations can continue using older versions. Release tarballs contain the generated machinery, so users do not need libtool installed to build them.Linux CI uses the distro-provided libtool again, without downloading or building a hardcoded version. macOS CI tests OpenMP in both the checkout and
make distcheck, including builds from the generated release tarball.On Homebrew macOS:
Validation on ARM macOS with Apple Clang and GNU Libtool 2.6.2: all 15 tests pass with OpenMP enabled, and
make distcheck DISTCHECK_CONFIGURE_FLAGS=--enable-openmppasses. With libtool 2.5.4, bootstrap and configuration without OpenMP pass, while Apple Clang OpenMP configuration fails with the intended explanatory error.