Unable to compile with Clang/AOCC: TLS support not detected correctly

Issue #82 resolved
Omri Mor created an issue

When using non-GCC compilers with support for __thread, this support can be detected incorrectly. configure checks for support for __thread in executables, and then for support in shared libraries—but this latter check uses gcc rather than $CC. While my system GCC should work correctly here, for some reason the mismatch seems to confuse it. (Or maybe it doesn’t find GCC at all—I’m using Spack, so maybe its path was sanitized? Though it’s in /usr/bin…)

In any case, fixing this seems to be as simple as replacing gcc with $CC on lines 727–728 in configure.in (and regenerating configure).

Besides the above, builds without TLS support fail catastrophically—several functions in papi_internal.c assume that _papi_hwi_my_thread is always available, but this is only defined in threads.h when HAVE_THREAD_LOCAL_STORAGE is defined.

Comments (4)

  1. Damien Genet

    We have an open PR#188 waiting for reviews that fixes the compiler in the configure file.

    As for the second issue with the TLS option, we’re considering removing the option and requiring a compiler with TLS support.

  2. Omri Mor reporter

    C11 has been out for nearly a decade now; I don’t imagine that there’s many systems wanting to install a new version of PAPI that don’t have access to a compiler that supports _Thread_local? Or just supports __thread as an extension.

  3. Log in to comment