Skip to content

Commit ecfab22

Browse files
Set lld as macOS linker only if SDK is greater or equal to 15 (#1190)
It seems that `lld` can't find the libs correctly in macOS SDK < 15 and this is blocking K's release: https://github.com/runtimeverification/k/actions/runs/12327347003/job/34409254563
1 parent dafdb9a commit ecfab22

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

cmake/FixHomebrew.cmake

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,19 @@ if(APPLE)
2121
link_directories(AFTER "${BREW_PREFIX}/lib")
2222
set(ENV{PKG_CONFIG_PATH} "${BREW_PREFIX}/opt/libffi/lib/pkgconfig")
2323

24-
# Use LLD as the linker
25-
# This is necessary as the default linker used by CMake on macOS is
26-
# ld64, which currently has some incompatibilities with Homebrew and XCode15.
27-
# See: https://github.com/orgs/Homebrew/discussions/4794#discussioncomment-7044468
28-
# Adding this flag avoid the following errors:
29-
# ld: warning: duplicate -rpath ... ignored
30-
# ld: warning: ignoring duplicate libraries ...
31-
add_link_options("-fuse-ld=lld")
24+
if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
25+
message(STATUS "Building for macOS deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}")
26+
if(CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER_EQUAL "15")
27+
# Use LLD as the linker
28+
# This is necessary as the default linker used by CMake on macOS is
29+
# ld64, which currently has some incompatibilities with Homebrew and XCode15.
30+
# See: https://github.com/orgs/Homebrew/discussions/4794#discussioncomment-7044468
31+
# Adding this flag avoid the following errors:
32+
# ld: warning: duplicate -rpath ... ignored
33+
# ld: warning: ignoring duplicate libraries ...
34+
add_link_options("-fuse-ld=lld")
35+
endif()
36+
endif()
3237

3338
endif() # USE_NIX
3439
endif() # APPLE

0 commit comments

Comments
 (0)