[Openmp-commits] [PATCH] D59451: Fix gettid warnings and one test on FreeBSD

Dimitry Andric via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Mar 23 14:02:12 PDT 2019


dim added a subscriber: tra.
dim added a comment.

Using CMake's own FindThreads package is obviously the correct solution for finding the right compiler and linker options for enabling threading.

However, we unfortunately have this rather nasty hack in our top-level `llvm/trunk/cmake/config-ix.cmake`, introduced in rL273302 <https://reviews.llvm.org/rL273302> by @tra :

  if(HAVE_LIBPTHREAD)
    # We want to find pthreads library and at the moment we do want to
    # have it reported as '-l<lib>' instead of '-pthread'.
    # TODO: switch to -pthread once the rest of the build system can deal with it.
    set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
    set(THREADS_HAVE_PTHREAD_ARG Off)
    find_package(Threads REQUIRED)
    set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
  endif()

E.g. this prevents the use of `CMAKE_THREAD_LIBS_INIT` to get the correct `-pthread` option on systems that require it.  I can obviously hack this into OpenMP's own CMake files, but it would probably be nicer to fix it in the top-level LLVM CMake files.

I am unsure whether the problem with the build system as referred to by the remark "switch to -pthread once the rest of the build system can deal with it" is now solved, though. @tra, any idea?


Repository:
  rOMP OpenMP

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59451/new/

https://reviews.llvm.org/D59451





More information about the Openmp-commits mailing list