Thread overview
collect2: fatal error: cannot find 'ld'
Dec 08
Jack
Dec 08
Jack
December 08
I just installed ldc on open suse[1] but when I went to compile I get this error:

>collect2: fatal error: cannot find 'ld'
>compilation terminated.
>Error: /usr/bin/cc failed with status: 1

the command:
>whereis ld

return

>ld: /usr/bin/ld /usr/bin/ld.bfd /usr/share/man/man1/ld.1.gz 
>>/usr/share/info/ld.info.gz

So at least the terminal can find it in the PATH variable. How can I fix this for ldc?

[1]: with this script curl -fsS https://dlang.org/install.sh | bash -s ldc

December 08
On Tuesday, 8 December 2020 at 20:25:24 UTC, Jack wrote:
> I just installed ldc on open suse[1] but when I went to compile I get this error:
>
>>collect2: fatal error: cannot find 'ld'
>>compilation terminated.
>>Error: /usr/bin/cc failed with status: 1
>
> the command:
>>whereis ld
>
> return
>
>>ld: /usr/bin/ld /usr/bin/ld.bfd /usr/share/man/man1/ld.1.gz
>>>/usr/share/info/ld.info.gz
>
> So at least the terminal can find it in the PATH variable. How can I fix this for ldc?
>
> [1]: with this script curl -fsS https://dlang.org/install.sh | bash -s ldc

fixed with

sudo zypper install binutils-gold

for some reason reinstall binutils didn't work but install binutils-gold put ld somewhere where ldc2 could find
December 09
On Tuesday, 8 December 2020 at 20:41:42 UTC, Jack wrote:
> On Tuesday, 8 December 2020 at 20:25:24 UTC, Jack wrote:
>> I just installed ldc on open suse[1] but when I went to compile I get this error:
>>
>>>collect2: fatal error: cannot find 'ld'
>>>compilation terminated.
>>>Error: /usr/bin/cc failed with status: 1
>>
>> the command:
>>>whereis ld
>>
>> return
>>
>>>ld: /usr/bin/ld /usr/bin/ld.bfd /usr/share/man/man1/ld.1.gz
>>>>/usr/share/info/ld.info.gz
>>
>> So at least the terminal can find it in the PATH variable. How can I fix this for ldc?
>>
>> [1]: with this script curl -fsS https://dlang.org/install.sh | bash -s ldc
>
> fixed with
>
> sudo zypper install binutils-gold
>
> for some reason reinstall binutils didn't work but install binutils-gold put ld somewhere where ldc2 could find

If you compile with `-v`, you'll see that LDC calls `cc` for linking, and passes -fuse-ld=gold to cc on Linux, forcing the use of ld.gold. You can prevent this by passing `-linker=` (empty) to LDC, such that the default linker is used by `cc`.

cheers,
  Johan