Thread overview
How to get *32mscoff libraries for phobos?
Jul 22, 2015
Taylor Hillegeist
Jul 22, 2015
Jonathan M Davis
Jul 23, 2015
Mike Parker
Jul 23, 2015
Mike Parker
Jul 23, 2015
Mike Parker
Jul 23, 2015
Taylor Hillegeist
Jul 23, 2015
Taylor Hillegeist
Jul 23, 2015
Taylor Hillegeist
Jul 23, 2015
Taylor Hillegeist
July 22, 2015
I have tried to build this and failed miserably. I have some questions?
What make do you use? digital mars, gnu. what tools do you need? is it possible? I also failed to build zlib32coff.lib

make[2]: *** No rule to make target `zlib32mscoff.lib'.  Stop.

I could say more but it probably wouldn't be useful.
July 22, 2015
On Wednesday, July 22, 2015 20:27:35 Taylor Hillegeist via Digitalmars-d-learn wrote:
> I have tried to build this and failed miserably. I have some
> questions?
> What make do you use? digital mars, gnu. what tools do you need?
> is it possible? I also failed to build zlib32coff.lib
>
> make[2]: *** No rule to make target `zlib32mscoff.lib'.  Stop.
>
> I could say more but it probably wouldn't be useful.

AFAIK, COFF is not supported by dmd for 32-bit Windows. Walter made it so that the 64-bit support used COFF and the VS linker rather than optlink, but he left the 32-bit stuff as it was, so it still uses OMF and optlink.

- Jonathan M Davis

July 23, 2015
On Wednesday, 22 July 2015 at 20:27:37 UTC, Taylor Hillegeist wrote:
> I have tried to build this and failed miserably. I have some questions?
> What make do you use? digital mars, gnu. what tools do you need? is it possible? I also failed to build zlib32coff.lib
>
> make[2]: *** No rule to make target `zlib32mscoff.lib'.  Stop.
>
> I could say more but it probably wouldn't be useful.

First off, make sure you build a 32-bit COFF version of Phobos. DMD does not ship with it by default. You can use the Druntime and Phobos source included in the DMD distribution. You'll need to make sure you have Microsoft toolchain installed. See the post at [1] where Rainer shared the relevant bits of a batch file he uses to build. Visual Studio provides links in the Start menu to open up command prompts with a preconfigured environment, so if you use that you don't need the configuration at the top of the batch file.

Once the library is built, it will be written out in the Phobos source directory. I learned that it's not enough to copy it to DMD's lib directory -- it's never picked up. I copied it to the 8.1 SDK lib directory.

Any C libraries you use will need to be compiled with Visual Studio (or a version of clang using the MS toolchain). When compiling D libraries or apps with DMD, pass the -m32mscoff switch. If you use DUB, you'll need to add it to your configuration in an -lflags directive.
July 23, 2015
On Wednesday, 22 July 2015 at 23:39:46 UTC, Jonathan M Davis wrote:
> On Wednesday, July 22, 2015 20:27:35 Taylor Hillegeist via Digitalmars-d-learn wrote:
>> I have tried to build this and failed miserably. I have some
>> questions?
>> What make do you use? digital mars, gnu. what tools do you need?
>> is it possible? I also failed to build zlib32coff.lib
>>
>> make[2]: *** No rule to make target `zlib32mscoff.lib'.  Stop.
>>
>> I could say more but it probably wouldn't be useful.
>
> AFAIK, COFF is not supported by dmd for 32-bit Windows. Walter made it so that the 64-bit support used COFF and the VS linker rather than optlink, but he left the 32-bit stuff as it was, so it still uses OMF and optlink.
>
> - Jonathan M Davis

Rainer worked on it last year. I believe 2.067 was the first release to support it, though it isn't documented in the compiler's help list.
July 23, 2015
On Thursday, 23 July 2015 at 01:39:05 UTC, Mike Parker wrote:

> post at [1] where Rainer shared the relevant bits of a batch

Gah, hate it when I forget the links.

[1] http://forum.dlang.org/post/m456t5$2jc4$1@digitalmars.com


July 23, 2015
On Thursday, 23 July 2015 at 01:43:56 UTC, Mike Parker wrote:
> On Thursday, 23 July 2015 at 01:39:05 UTC, Mike Parker wrote:
>
>> post at [1] where Rainer shared the relevant bits of a batch
>
> Gah, hate it when I forget the links.
>
> [1] http://forum.dlang.org/post/m456t5$2jc4$1@digitalmars.com

IT worked! Placing this Batch file in the dmd2\src Folder.

---------------------------------- BEGIN FILE: BUILD.bat
set dm_make=C:\D\dmd2\windows\bin\make.exe
set DMD=C:\D\dmd2\windows\bin\dmd.exe
set cl32=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe
set ar32=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\lib.exe

cd druntime
del /q errno_c.obj complex.obj
%dm_make% -f win64.mak DMD=%DMD% MODEL=32mscoff "CC=\"%cl32%\""
if errorlevel 1 goto xit
cd ..

cd phobos
cd etc\c\zlib
%dm_make% -f win64.mak clean
cd ..\..\..
%dm_make% -f win64.mak DMD=%DMD% MODEL=32mscoff "CC=\"%cl32%\"" MAKE=%dm_make% "AR=\"%ar32%\""
if errorlevel 1 goto xit
cd ..

---------------------------------- END FILE

I had to reinstall dmd (I think I messed up my dmd2\src folder somehow)
I used visual studio 2013 community edition.

SO. Where do i put it now that its built? I placed it in the dmd2\windows\lib and i still got LINK : fatal error LNK1104: cannot open file 'phobos32mscoff.lib'

... perhaps i need to edit the sc.ini file...
July 23, 2015
On Thursday, 23 July 2015 at 14:56:48 UTC, Taylor Hillegeist wrote:
> On Thursday, 23 July 2015 at 01:43:56 UTC, Mike Parker wrote:
>> [...]
>
> IT worked! Placing this Batch file in the dmd2\src Folder.
>
> ---------------------------------- BEGIN FILE: BUILD.bat
> set dm_make=C:\D\dmd2\windows\bin\make.exe
> set DMD=C:\D\dmd2\windows\bin\dmd.exe
> set cl32=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe
> set ar32=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\lib.exe
>
> [...]

I found this nugget in the sc.ini file!

[Environment32mscoff]
LIB="%@P%\..\lib32mscoff"

Apparently i need to create a lib32mscoff folder in C:\D\dmd2\windows\
July 23, 2015
On Thursday, 23 July 2015 at 15:23:07 UTC, Taylor Hillegeist wrote:
> I found this nugget in the sc.ini file!
>
> [Environment32mscoff]
> LIB="%@P%\..\lib32mscoff"
>
> Apparently i need to create a lib32mscoff folder in C:\D\dmd2\windows\

Well if its not one thing its always another :)

LINK : fatal error LNK1104: cannot open file 'LIBC.lib'

This file is not on my computer... In recent versions of VC it has been replaced with LIBCMT.lib (multi-thread). So not really sure what the right thing is to do here.
July 23, 2015
On Thursday, 23 July 2015 at 15:39:15 UTC, Taylor Hillegeist wrote:
> On Thursday, 23 July 2015 at 15:23:07 UTC, Taylor Hillegeist wrote:
>> I found this nugget in the sc.ini file!
>>
>> [Environment32mscoff]
>> LIB="%@P%\..\lib32mscoff"
>>
>> Apparently i need to create a lib32mscoff folder in C:\D\dmd2\windows\
>
> Well if its not one thing its always another :)
>
> LINK : fatal error LNK1104: cannot open file 'LIBC.lib'
>
> This file is not on my computer... In recent versions of VC it has been replaced with LIBCMT.lib (multi-thread). So not really sure what the right thing is to do here.

LOL... I copied LIBCMT.lib and renamed it LIBC.lib and it worked... so if it works? Thanks everyone!