Issue 137472
Summary [macOS] openmp fails to find pthread even though it's found by llvm
Labels new issue
Assignees
Reporter Phatcat
    When compiling llvm from source with openmp:
```
(…) 
-- Looking for pthread_create in pthread 
-- Looking for pthread_create in pthread - found 
-- Looking for pthread_rwlock_init in pthread 
-- Looking for pthread_rwlock_init in pthread - found 
-- Looking for pthread_mutex_lock in pthread 
-- Looking for pthread_mutex_lock in pthread - found 
(…) 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success 
-- Found Threads: TRUE 
(…) 
-- Looking for pthread_getname_np 
-- Looking for pthread_getname_np - found 
-- Looking for pthread_setname_np 
-- Looking for pthread_setname_np - found 
(…)
-- Check if compiler accepts -pthread 
-- Check if compiler accepts -pthread - no 
CMake Error at /Applications/CMake.app/Contents/share/cmake-4.0/Modules/FindPackageHandleStandardArgs.cmake:227 (message): Could NOT find Threads (missing: Threads_FOUND) Call Stack (most recent call first): /Applications/CMake.app/Contents/share/cmake-4.0/Modules/FindPackageHandleStandardArgs.cmake:591 (_FPHSA_FAILURE_MESSAGE) /Applications/CMake.app/Contents/share/cmake-4.0/Modules/FindThreads.cmake:226 (find_package_handle_standard_args) /Users/holsthein/llvm-project/openmp/runtime/cmake/config-ix.cmake:162 (find_package) /Users/holsthein/llvm-project/openmp/runtime/CMakeLists.txt:283 (include)
```

I then edited the FindThreads in Cmake to return true on apple without the flag and... I got this instead:

```
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
CMake Error at /Users/holsthein/llvm-project/openmp/runtime/cmake/LibompUtils.cmake:26 (message):
  LIBOMP: Need pthread interface on Unix-like systems.
Call Stack (most recent call first):
  /Users/holsthein/llvm-project/openmp/runtime/cmake/config-ix.cmake:169 (libomp_error_say)
  /Users/holsthein/llvm-project/openmp/runtime/CMakeLists.txt:283 (include)
```

The way openmp is set up to look for and utilize threads on mac seems to be faulty?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to