Thread overview
Building D from source on Windows
Jan 16, 2014
Andrew Edwards
Jan 16, 2014
evilrat
Jan 16, 2014
Andrew Edwards
Jan 16, 2014
Dmitry Olshansky
Jan 16, 2014
Andrew Edwards
January 16, 2014
I'm having problems setting up my programming environment on Windows and would really appreciate some assistance. Following instructions for Windows at [1], everything builds fine, however I cannot build with DMD afterwards because of linker errors.

The first such error said that the file C:\D\dmd2\windows\bin\link.exe was missing. I moved a copy of link.exe from an from v2.064.2 to that location to try to remedy the situation. It did not work I was bombarded with a slew of errors like the one bellow:

    ..\druntime\lib\druntime.lib(thread)
    Error 35: Cannot Reach TARGET from FRAME at Relative 00041H from Segment _TEXT
    Segment _TEXT
    FRAME  = Frame of Group FLAT 000000H
    TARGET = External Symbol _D4core6thread6Thread7sm_thisC4Core6thread6Thread 93D24H
    FIXUP Type = Unknown Type
    --- errorlevel 1342

I am using Windows 7 Home Premium.

[1] http://wiki.dlang.org/Building_DMD
January 16, 2014
On Thursday, 16 January 2014 at 17:41:02 UTC, Andrew Edwards wrote:
> I'm having problems setting up my programming environment on Windows and would really appreciate some assistance. Following instructions for Windows at [1], everything builds fine, however I cannot build with DMD afterwards because of linker errors.
>
> The first such error said that the file C:\D\dmd2\windows\bin\link.exe was missing. I moved a copy of link.exe from an from v2.064.2 to that location to try to remedy the situation. It did not work I was bombarded with a slew of errors like the one bellow:
>
>     ..\druntime\lib\druntime.lib(thread)
>     Error 35: Cannot Reach TARGET from FRAME at Relative 00041H from Segment _TEXT
>     Segment _TEXT
>     FRAME  = Frame of Group FLAT 000000H
>     TARGET = External Symbol _D4core6thread6Thread7sm_thisC4Core6thread6Thread 93D24H
>     FIXUP Type = Unknown Type
>     --- errorlevel 1342
>
> I am using Windows 7 Home Premium.
>
> [1] http://wiki.dlang.org/Building_DMD

is this x64? probably windows .lib's not linked such as kernel32 and others...
January 16, 2014
16-Jan-2014 21:41, Andrew Edwards пишет:
> I'm having problems setting up my programming environment on Windows and
> would really appreciate some assistance. Following instructions for
> Windows at [1], everything builds fine, however I cannot build with DMD
> afterwards because of linker errors.
>
> The first such error said that the file C:\D\dmd2\windows\bin\link.exe
> was missing. I moved a copy of link.exe from an from v2.064.2 to that
> location to try to remedy the situation. It did not work I was bombarded
> with a slew of errors like the one bellow:
>

I'd suggest getting a fresh optlink. Walter posted ftp links to it not long ago (DigitalMars public FTP).

it would help to know when exactly this problem comes up. I guess bulding Phobos?
>      ..\druntime\lib\druntime.lib(thread)
>      Error 35: Cannot Reach TARGET from FRAME at Relative 00041H from
> Segment _TEXT
>      Segment _TEXT
>      FRAME  = Frame of Group FLAT 000000H
>      TARGET = External Symbol
> _D4core6thread6Thread7sm_thisC4Core6thread6Thread 93D24H
>      FIXUP Type = Unknown Type
>      --- errorlevel 1342
>
It could also mean that you are trying to link x64 object files with optlink.Being dump the tool thinks that it's a 32bit object just horribly broken. x64 requires its own section in sc.ini and MS Visual Studio with.

Try specifying model directly:
make MODEL=32 -fwin32.mak

and if it doesn't help clean it first and try again:
make MODEL=32 -fwin32.mak clean
make MODEL=32 -fwin32.mak

Also - always first build druntime, then Phobos. Always with the same MODEL.

I've found that to cleanly build x64 and 32 on windows I have to run clean between builds (unlike in Linux/MacOS).


-- 
Dmitry Olshansky
January 16, 2014
On 1/16/14, 1:10 PM, evilrat wrote:
> On Thursday, 16 January 2014 at 17:41:02 UTC, Andrew Edwards wrote:

>> I am using Windows 7 Home Premium.
>>
>> [1] http://wiki.dlang.org/Building_DMD
>
> is this x64? probably windows .lib's not linked such as kernel32 and
> others...

Yes. Win7x64
January 16, 2014
On 1/16/14, 2:03 PM, Dmitry Olshansky wrote:
> 16-Jan-2014 21:41, Andrew Edwards пишет:
>
> it would help to know when exactly this problem comes up. I guess
> bulding Phobos?

dmd, druntime, and phobos all build properly. The problem comes up when trying to build with dmd.

>>
> It could also mean that you are trying to link x64 object files with
> optlink.Being dump the tool thinks that it's a 32bit object just
> horribly broken. x64 requires its own section in sc.ini and MS Visual
> Studio with.

I took the sc.ini file from v2.064.2 and it does have that section. I don't however have Visual Studio installed so that might be contributing to the problem.

> Try specifying model directly:
> make MODEL=32 -fwin32.mak
>
> and if it doesn't help clean it first and try again:
> make MODEL=32 -fwin32.mak clean
> make MODEL=32 -fwin32.mak
>
> Also - always first build druntime, then Phobos. Always with the same
> MODEL.
>
> I've found that to cleanly build x64 and 32 on windows I have to run
> clean between builds (unlike in Linux/MacOS).

Ok. Got it, I'll give this a try as soon as I can get back to my system.