-
-
Notifications
You must be signed in to change notification settings - Fork 268
CMake error on macOS Monterey, library not found for -lpthread #3901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks, finally some insights for #3871. [It's apparently |
I wonder if we can "fix" this by setting |
Solutions that work:
These do not work:
|
Yeah, I've seen/wondered about |
That turned out to be the problem for CI (using |
So should we stop adding |
IIRC I tested that assumption via CI in #4580, but that has only shown (IIRC) that even |
IIUC from https://gitlab.kitware.com/cmake/cmake/-/issues/19120#note_553967, the fundamental problem is that the actual compilers NOT in
That problem (with (default) It looks like CMake 4 doesn't resolve the actual compilers for Apple targets anymore, but uses the |
The first time running cmake on macOS Monterey, I see this error:
Simply rerunning cmake works and creates a fine build configuration for LDC (
ninja
works fine afterwards).I've traced the problem down to the following:
There are two
cc
executables on macOS:/usr/bin/cc
and/Library/Developer/CommandLineTools/usr/bin/cc
. The first one,/usr/bin/cc
is usually used by LDC, and correctly findslibpthread
, so LDC can link executables without problem. The second one,/Library/Developer/CommandLineTools/usr/bin/cc
, is not able to findlibpthread
and therefore fails linking when invoked by LDC.In the
execute_process
enviroment of CMake, theCC
environment variable is set to/Library/Developer/CommandLineTools/usr/bin/cc
; this is the C compiler detected by CMake (CMake outputs:-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
). LDC uses theCC
variable to find the C compiler, thus the linking problem occurs.I wonder if this is a problem in CMake, that should detect
/usr/bin/cc
instead of the other one.I'm using CMake 3.22.1.
The text was updated successfully, but these errors were encountered: