botan icon indicating copy to clipboard operation
botan copied to clipboard

Can't build on Windows (32 bit or 64 bit)

Open ghost opened this issue 9 years ago • 7 comments

Hi,

I'm trying to build using the subConfigurations option for 32 bit, or the arch option for 64 bit on Windows; however I get the following errors:

64 Bit:

dub --arch=x86_64
Running pre-generate commands for botan...
Error executing command run: Command failed with exit code 1

32 Bit (after dub clean):

dub --force
Building memutils 0.3.5 configuration "secure", build type debug.
Running dmd...
Enhanced memory security is enabled.
Building botan 1.11.12 configuration "32mscoff", build type debug.
Running dmd...
Enhanced memory security is enabled.
Building test ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
.dub\build\application-debug-windows-x86-dmd_2067-    C50BC4185BBE7C980ABADA87EFB92331\test.obj Offset 00000H Record Type 004C
 Error 138: Module or Dictionary corrupt
--- errorlevel 1
FAIL .dub\build\application-debug-windows-x86-dmd_2067-     C50BC4185BBE7C980ABADA87EFB92331\ test executable
Error executing command run: dmd failed with exit code 1.

Any suggestions to remedy this?

ghost avatar May 07 '15 15:05 ghost

Hi there,

It looks like the 64 bit version is failing silently although it shoud display the contents of file: dmd64_build_instructions.txt - you must build a 64 bit version of DMD 2.067.1 through the visual studio solution included in the source.

Also, are you using a linux shell on windows (msys)?

As for the 32 bit version, it cannot link with anything but the Microsoft Visual Studio linker (mscoff format). Using optlink is going to fail because there are too many symbols.

To remedy this, you must compile the 32mscoff variations of druntime, phobos, and put them in the dmd2/windows/lib32mscoff/ folder. Also, you must add this to your dub.json: "dflags-windows-x86": ["-m32mscoff"]

To compile the 32mscoff variations, you must modify the win64.mak with MODEL=32mscoff here: https://github.com/D-Programming-Language/phobos/blob/master/win64.mak#L19

Also, the libraries must be fetched in the 32bit version of visual studio, so you must change these paths as apprioriate: https://github.com/D-Programming-Language/phobos/blob/master/win64.mak#L55

This is a little complicated I admit, but this library was only made possible at all very recently.

etcimon avatar May 07 '15 16:05 etcimon

you must build a 64 bit version of DMD 2.067.1

Gotcha, I'm currently using 2.067.0, I'll update this and try again later.

Also, are you using a linux shell on windows (msys)?

Both, been playing around with cmder, but I've also tried in the cmd prompt. The error messages were out of cmder for copy and paste purposes.

This is a little complicated I admit, but this library was only made possible at all very recently.

Appreciate the work, and I don't mind the inconvenience. I'd rather use an existing bcrypt library than make one myself.

I'll update once I get a chance to go back through this.

ghost avatar May 07 '15 17:05 ghost

Gotcha, I'm currently using 2.067.0, I'll update this and try again later.

The 64 bit version isn't default, you have to clone the dmd git repo and open up the src/dmd_msc_vs10.sln file

Appreciate the work, and I don't mind the inconvenience. I'd rather use an existing bcrypt library than make one myself.

There's much more than bcrypt in there, if you're looking to use it for TLS there is a very advanced vibe.d fork here for it (and for http/2)

https://github.com/etcimon/vibe.d/tree/http2-backup

etcimon avatar May 07 '15 17:05 etcimon

There's much more than bcrypt in there, if you're looking to use it for TLS there is a very advanced vibe.d fork here for it (and for http/2) https://github.com/etcimon/vibe.d/tree/http2-backup

Yeah, I know it has a lot more in there, but I really only need bcrypt.

TLS is nice; however, this is only good for the transport layer, and not good for the endpoint (the database). That's where I need bcrypt as Vibe doesn't have a good alternative, even in the source code it says to look elsewhere. Here's a pretty good article on why you should really only consider Bcrypt for your passwords.

ghost avatar May 07 '15 19:05 ghost

I thought you could use something like -m64 (or the like) to enable 64bit compiling within windows?

dariusc93 avatar May 13 '15 02:05 dariusc93

It fails because DMD32 runs out of memory on the full build with -m64. This is because 64 bit pointers take twice the space =)

etcimon avatar May 13 '15 02:05 etcimon

Any chance to get Botan for Windows as standalone executable?

sergeevabc avatar Dec 15 '16 05:12 sergeevabc