www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - LDC won't find ld linker -why?

reply Dukc <ajieskola gmail.com> writes:
I just downloaded ldc 1.15.0 for Linux from GH releases. Testing 
it, it will make the object file out of a hello world 
application, but then complain:
```
collect2: fatal error: cannot find ‘ld’
compilation terminated.
```

This is strange, because running either `ld` or `clang` (yes, I 
checked readme file) in the same directory as the compilation 
will indicate that I have both of them. And clang is version 8, 
same as the llvm version that 1.15.0 is based on. dmd works 
correctly, but downloaded that as `.rpm`.

If it makes any difference, I just dumped the contents of the ldc 
download folder directly into my home, so that there is 
`~/bin/ldc2`, `~/etc/ldc2.conf`, and so on.

Making a symlink to ld into ~/bin won't make a difference, and 
`ln` won't let me to make a hard link, it complains about 
something like invalid link between devices (ln is in `usr/bin/` 
which should be on same drive and partition as `~/bin`).

What could be wrong?
Jul 09 2019
next sibling parent Dukc <ajieskola gmail.com> writes:
On Tuesday, 9 July 2019 at 15:25:17 UTC, Dukc wrote:
 (ln is in `usr/bin/`
meant that `ld` is there
Jul 09 2019
prev sibling parent reply Johan Engelen <j j.nl> writes:
On Tuesday, 9 July 2019 at 15:25:17 UTC, Dukc wrote:
 I just downloaded ldc 1.15.0 for Linux from GH releases. 
 Testing it, it will make the object file out of a hello world 
 application, but then complain:
 ```
 collect2: fatal error: cannot find ‘ld’
 compilation terminated.
 ```
Run LDC with "-v" and check what the linker command is (somewhere at the bottom, LDC invokes `gcc` for linking). You might see something like `-Wl,-fuse-ld=...` in that gcc command line. Perhaps that ld.gold / ld.bfd is not installed and thus GCC complains that it cannot find it. See e.g. https://askubuntu.com/questions/798453/collect2-fatal-error-cannot-find-ld-compilation-terminated -Johan
Jul 10 2019
parent Dukc <ajieskola gmail.com> writes:
On Wednesday, 10 July 2019 at 23:15:38 UTC, Johan Engelen wrote:
 On Tuesday, 9 July 2019 at 15:25:17 UTC, Dukc wrote:
 I just downloaded ldc 1.15.0 for Linux from GH releases. 
 Testing it, it will make the object file out of a hello world 
 application, but then complain:
 ```
 collect2: fatal error: cannot find ‘ld’
 compilation terminated.
 ```
Run LDC with "-v" and check what the linker command is (somewhere at the bottom, LDC invokes `gcc` for linking). You might see something like `-Wl,-fuse-ld=...` in that gcc command line. Perhaps that ld.gold / ld.bfd is not installed and thus GCC complains that it cannot find it. See e.g. https://askubuntu.com/questions/798453/collect2-fatal-error-cannot-find-ld-compilation-terminated -Johan
Thanks, that worked, I needed ld.gold. There was a catch, however: one would think that `llvm8-gold` is the .rpm package in question, but installing it did change nothing. Good that you provided that link, otherwise I would never have quessed that I have to install `binutils-gold` instead.
Jul 11 2019