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
[SR-6878] clang-5.0: error: invalid linker name in argument '-fuse-ld=lld' #49427
Comments
Dave, can you please take a look at this? |
How strange. -fuse-ld=lld is conditional upon `ld.lld` existing. I'm still digging… |
Maybe Clang has a built-in set of valid linkers and lld isn't one of them? The error doesn't say anything about the linker not existing. We may need to pull in a clang patch or something. |
Hi Bob – At best, I have a speculative "not Apple" fix. What do you want to do? Here it is, for reference: // diff --git i/cmake/modules/AddSwift.cmake w/cmake/modules/AddSwift.cmake
index 789767f8f1..19bf77720e 100644
--- i/cmake/modules/AddSwift.cmake
+++ w/cmake/modules/AddSwift.cmake
@@ -405,7 +405,8 @@ function(_add_variant_link_flags)
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
find_program(LDLLD_PATH "ld.lld")
- if((SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH) OR
+ # Strangely, macOS finds lld and then can't find it when using -fuse-ld=
+ if((SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH AND NOT APPLE) OR
("${LFLAGS_SDK}" STREQUAL "WINDOWS" AND
NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WINDOWS"))
list(APPEND result "-fuse-ld=lld")
diff --git i/cmake/modules/AddSwiftUnittests.cmake w/cmake/modules/AddSwiftUnittests.cmake
index 9caa8f4569..52dcbabab5 100644
--- i/cmake/modules/AddSwiftUnittests.cmake
+++ w/cmake/modules/AddSwiftUnittests.cmake
@@ -48,7 +48,8 @@ function(add_swift_unittest test_dirname)
endif()
find_program(LDLLD_PATH "ld.lld")
- if(SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH)
+ # Strangely, macOS finds lld and then can't find it when using -fuse-ld=
+ if(SWIFT_ENABLE_LLD_LINKER AND LDLLD_PATH AND NOT APPLE)
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY
LINK_FLAGS " -fuse-ld=lld")
elseif(SWIFT_ENABLE_GOLD_LINKER AND |
See GitHub PR #14306 if you want the speculative fix. |
Hi @bob-wilson — I've merged #14306. Please let me know if it helps or not. |
Hi Bob – Please close this or assign this back to me if builds at Apple are still grumpy. Thanks! |
Sorry for the delay in looking at this. Clang has this code: if (Triple.isOSDarwin())
LinkerName.append("ld64.");
else
LinkerName.append("ld."); When you specify -fuse-ld=lld on Darwin, Clang will look for ld64.lld. For some context, see https://reviews.llvm.org/D38290. We could conditionalize the find_program test here to match, but judging from the comments on the patch review, it doesn't sound like lld is really ready for prime time on Darwin. Leaving it disabled for Apple platforms seems like the right thing for now, but I'd like to clarify that code to avoid future confusion. |
Let's just close this because when `lld` on Darwin matures to the point that Swift wants to adopt it on Darwin, then the right thing will happen anyway. We don't need this bug. |
I left it open on purpose to remind me to follow up. I still want to follow up, at least to fix the comment in that change. |
Comment update here: #16407 |
Additional Detail from JIRA
md5: 611b3838863bc284e22e68cac1cfe127
Issue Description:
At least some builds are failing with:
clang-5.0: error: invalid linker name in argument '-fuse-ld=lld'
https://ci.swift.org/job/swift-package-manager-PR-osx-smoke-test/192
(from apple/swift-package-manager#1475
This looks like fallout from Dave Z's change:
commit 9182327
Author: David Zarzycki <dave@znu.io>
Date: Tue Jan 30 07:18:36 2018 -0500
[build system] Prefer LLD if it exists (#14165)
The text was updated successfully, but these errors were encountered: