Thread overview
Linker error since upgrade to DMD 2.077.1: fatal error C1905: Front end and back end not compatible
Dec 17, 2017
ParticlePeter
Dec 17, 2017
ParticlePeter
Dec 17, 2017
John
Dec 17, 2017
ParticlePeter
Dec 17, 2017
John
Dec 17, 2017
ParticlePeter
Dec 17, 2017
ParticlePeter
Dec 17, 2017
ParticlePeter
Dec 17, 2017
ParticlePeter
December 17, 2017
I upgraded from DMD 2.074.1 (!) to 2.077.1 and tried to compile a mixed c++/d project (DMD links to one c++ lib). Here is the full error message:

fatal error C1905: Front end and back end not compatible (must target same processor).
LINK : fatal error LNK1257: code generation failed
Error: linker exited with status 1257
dmd failed with exit code 1257.

No such problems with my previous DMD version.

What has changed with linking since then? (Skimmed through changelogs but found nothing).

I found a workaround with specifying LINKCMD64 to my VS 2017 linker, but this is not a viable solution. The project must build with DMD on any system with VS installed without me knowing its exact location.

What can I do to make it run out of the box and without the link command specified?


December 17, 2017
On Sunday, 17 December 2017 at 15:57:08 UTC, ParticlePeter wrote:
> I upgraded from DMD 2.074.1 (!) to 2.077.1 and tried to compile a mixed c++/d project (DMD links to one c++ lib). Here is the full error message:

Forgot most important info, ita an x64 project those used VS linker by default afaik.
December 17, 2017
On Sunday, 17 December 2017 at 15:57:08 UTC, ParticlePeter wrote:
> I upgraded from DMD 2.074.1 (!) to 2.077.1 and tried to compile a mixed c++/d project (DMD links to one c++ lib). Here is the full error message:
>
> fatal error C1905: Front end and back end not compatible (must target same processor).
> LINK : fatal error LNK1257: code generation failed
> Error: linker exited with status 1257
> dmd failed with exit code 1257.
>
> No such problems with my previous DMD version.
>
> What has changed with linking since then? (Skimmed through changelogs but found nothing).
>
> I found a workaround with specifying LINKCMD64 to my VS 2017 linker, but this is not a viable solution. The project must build with DMD on any system with VS installed without me knowing its exact location.
>
> What can I do to make it run out of the box and without the link command specified?

Yah the sc.ini file is wrong for Environment64.


[Environment64]
LIB="%@P%\..\lib64"

.
.
.

; Windows installer uncomments the version detected
LINKCMD=%VCINSTALLDIR%\bin\HostX86\x86\link.exe
December 17, 2017
On Sunday, 17 December 2017 at 16:40:46 UTC, John wrote:
> Yah the sc.ini file is wrong for Environment64.
>
>
> [Environment64]
> LIB="%@P%\..\lib64"
>
> .
> .
> .
>
> ; Windows installer uncomments the version detected
> LINKCMD=%VCINSTALLDIR%\bin\HostX86\x86\link.exe

Thanks! Is this a known, reported bug?
December 17, 2017
On Sunday, 17 December 2017 at 17:15:57 UTC, ParticlePeter wrote:
> On Sunday, 17 December 2017 at 16:40:46 UTC, John wrote:
>> Yah the sc.ini file is wrong for Environment64.
>>
>>
>> [Environment64]
>> LIB="%@P%\..\lib64"
>>
>> .
>> .
>> .
>>
>> ; Windows installer uncomments the version detected
>> LINKCMD=%VCINSTALLDIR%\bin\HostX86\x86\link.exe
>
> Thanks! Is this a known, reported bug?

I don't think so, all that would need to be changed is this line:

https://github.com/dlang/dmd/blob/v2.077.1/ini/windows/bin/sc.ini#L53

Not very many people use it I guess if it's been there for 8 months lol.
December 17, 2017
On Sunday, 17 December 2017 at 17:56:47 UTC, John wrote:

> I don't think so, all that would need to be changed is this line:
>
> https://github.com/dlang/dmd/blob/v2.077.1/ini/windows/bin/sc.ini#L53
>
> Not very many people use it I guess if it's been there for 8 months lol.

Hm, actually that line IS uncommented in my installed sc.ini and VCINSTALLDIR is properly detected. Any idea what still might go wrong?


December 17, 2017
On Sunday, 17 December 2017 at 19:16:02 UTC, ParticlePeter wrote:
> On Sunday, 17 December 2017 at 17:56:47 UTC, John wrote:
>
>> I don't think so, all that would need to be changed is this line:
>>
>> https://github.com/dlang/dmd/blob/v2.077.1/ini/windows/bin/sc.ini#L53
>>
>> Not very many people use it I guess if it's been there for 8 months lol.
>
> Hm, actually that line IS uncommented in my installed sc.ini and VCINSTALLDIR is properly detected. Any idea what still might go wrong?

Think I figured it out. For me it works when changing that particular line to:

LINKCMD=%VCINSTALLDIR%\bin\HostX32\x64\link.exe

or

LINKCMD=%VCINSTALLDIR%\bin\HostX64\x64\link.exe
December 17, 2017
On Sunday, 17 December 2017 at 19:29:00 UTC, ParticlePeter wrote:
> On Sunday, 17 December 2017 at 19:16:02 UTC, ParticlePeter wrote:
>> On Sunday, 17 December 2017 at 17:56:47 UTC, John wrote:
>>
>>> I don't think so, all that would need to be changed is this line:
>>>
>>> https://github.com/dlang/dmd/blob/v2.077.1/ini/windows/bin/sc.ini#L53
>>>
>>> Not very many people use it I guess if it's been there for 8 months lol.
>>
>> Hm, actually that line IS uncommented in my installed sc.ini and VCINSTALLDIR is properly detected. Any idea what still might go wrong?
>
> Think I figured it out. For me it works when changing that particular line to:
>
> LINKCMD=%VCINSTALLDIR%\bin\HostX32\x64\link.exe
>
> or
>
> LINKCMD=%VCINSTALLDIR%\bin\HostX64\x64\link.exe

First one is BS, of course it must be:

LINKCMD=%VCINSTALLDIR%\bin\HostX86\x64\link.exe


December 17, 2017
On Sunday, 17 December 2017 at 20:09:02 UTC, ParticlePeter wrote:
> On Sunday, 17 December 2017 at 19:29:00 UTC, ParticlePeter wrote:
>> On Sunday, 17 December 2017 at 19:16:02 UTC, ParticlePeter
[snip]
>> LINKCMD=%VCINSTALLDIR%\bin\HostX32\x64\link.exe
>>
>> or
>>
>> LINKCMD=%VCINSTALLDIR%\bin\HostX64\x64\link.exe
>
> First one is BS, of course it must be:
>
> LINKCMD=%VCINSTALLDIR%\bin\HostX86\x64\link.exe

Filed a bug:
https://issues.dlang.org/show_bug.cgi?id=18098