Repository navigation
Fix problem where ldc2 can't find linker - #4940
Merged
Merged
Conversation
Problem: on Ubuntu, you get ldc2 via a snap. The snap appears to be frozen in time (2021) and requires the "gold" linker. Google has lost interest in maintaining that as they're all in on llvm - and the llvm linker. As a result, binutils kicked ld.gold out of the main package as of 2.44. So now neither the linker ldc2 in the snap requires nor the logical alternative lld (the LLVM linker - ldc2 is LLVM based) are available in a default install of either Ubuntu or Fedora. The workaround here isn't ideal: we add a default flag to DLINKFLAGS (for ldc tool only) to request the always-present bfd linker. Along the way, found that the way the $DC is handled had a problem - values given to WhereIs for program finding are allowed to include args, and that was the first thing I tried, but that failed in the assumptions in DCommon. So that's fiddled a little bit - would like a review of this part. Signed-off-by: Mats Wichmann <mats@linux.com>
Collaborator
Author
|
Just to include this note - this isn't an SCons problem, the PR just proposes a workaround. You can reproduce outside SCons with something as simple as this, assuming package $ printf 'void main(){}' > t.d
$ ldc2 t.d
collect2: fatal error: cannot find 'ld'
compilation terminated.
Error: /usr/bin/cc failed with status: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: on Ubuntu, you get
ldc2via a snap. The snap appears to be frozen in time (2021) and requires thegoldlinker. Google has lost interest in maintaining that as they're all in on llvm - and the llvm linker. As a result,binutilskickedld.goldout of the main package as of 2.44. So now neither the linkerldc2in the snap is built to require nor the logical alternativelld(the LLVM linker - ldc2 is LLVM based) are available in a default install of either Ubuntu or Fedora.The workaround here isn't ideal: we add a flag to
DLINKFLAGS(for ldc tool only) to request the always-presentbfdlinker - which the ldc team took explicit pains to avoid. Along the way, found that the way the$DCis handled had a problem - values given toWhereIsfor program finding are allowed to include args, and that was the first thing I tried, but that failed in the assumptions in DCommon. So that's fiddled a little bit - would like a review of this part.Testing would be to install the ldc snap on Unbuntu, so the tests are actually run instead of skipping. On my test VMs with recent Ubuntu releases they were failing and now pass. Note that we don't install this snap, or in fact, any snap, in any of the GitHub runner images.
There aren't really any doc impacts, though we could consider adding a note to the docs somewhere about this new default - not quite sure where.
DLINKFLAGSis generic - applies to all three known D compilers. Other compiler-specific settings are not called out in the docs.Contributor Checklist:
CHANGES.txtandRELEASE.txt(and read theREADME.rst).