etcimon / botan

Block & stream ciphers, public key crypto, hashing, KDF, MAC, PKCS, TLS, ASN.1, BER/DER, etc.
Other
85 stars 22 forks source link

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

Closed ghost closed 1 year ago

ghost commented 9 years ago

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?

etcimon commented 9 years ago

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.

ghost commented 9 years ago

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.

etcimon commented 9 years ago

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

ghost commented 9 years ago

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.

dariusc93 commented 9 years ago

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

etcimon commented 9 years ago

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

sergeevabc commented 7 years ago

Any chance to get Botan for Windows as standalone executable?