Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSSL: can't build in VC++ 2010

I have downloaded the latest OpenSSL source package. I want to build it with VC++ 2010 x64. Following the instructions doesn't seem to work. Configure step looks fine, but then:

C:\1>ms\do_win64a.bat

C:\1>perl util\mkfiles.pl 1>MINFO

C:\1>perl ms\uplink.pl win64a 1>ms\uptable.asm

C:\1>ml64 -c -Foms\uptable.obj ms\uptable.asm Microsoft (R) Macro Assembler (x64) Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved.

Assembling: ms\uptable.asm

C:\1>perl util\mk1mf.pl no-asm VC-WIN64A 1>ms\nt.mak no rule for crypto\md4 at util\mk1mf.pl line 907.

C:\1>perl util\mk1mf.pl dll no-asm VC-WIN64A 1>ms\ntdll.mak no rule for crypto\md4 at util\mk1mf.pl line 907.

C:\1>perl util\mkdef.pl 32 libeay 1>ms\libeay32.def

C:\1>perl util\mkdef.pl 32 ssleay 1>ms\ssleay32.def

Win 32 (do_ms) output looks a bit different, but "no rule for crypto\md4 at util\mk1mf.pl line 907" remains.

Could anyone help me in building the library or share vc2010-built binaries?.. Or a VS2010 project file for the library?

like image 444
Violet Giraffe Avatar asked Oct 06 '11 20:10

Violet Giraffe


4 Answers

The problem seems to be related to eol (end of lines). The solution is to patch mk1mf.pl to make it remove the carriage-return:

Index: mk1mf.pl
===================================================================
--- mk1mf.pl    (revision 88908)
+++ mk1mf.pl    (working copy)
@@ -315,7 +315,7 @@
 for (;;)
        {
        chop;

+       s/\r$//; #remove carriage return too!
        ($key,$val)=/^([^=]+)=(.*)/;
        if ($key eq "RELATIVE_DIRECTORY")
                {

Found the solution in openssl users mailing:

http://groups.google.com/group/mailing.openssl.users/browse_thread/thread/42a8f226f1fc279f)

like image 149
Kaniabi Avatar answered Nov 14 '22 21:11

Kaniabi


The patch provided above works, but a better solution is to use use ActivePerl, as recommended in the OpenSSL documentation.

http://www.activestate.com/activeperl/downloads

Other perl builds such as the MSYS build will give you this error.

In order to figure out if you're using ActivePerl, run perl.exe --version in a command prompt. It should say something like:

Binary build 1601 [296175] provided by ActiveState http://www.ActiveState.com
like image 44
gregschlom Avatar answered Nov 14 '22 20:11

gregschlom


Looks like you're using MSYS perl, which follows unix-style line endings. You should use sources extracted from .tar.gz by MSYS tools:

  $ tar zxvf openssl-1.0.2d.tar.gz

or checkout from git with configuration "autocrlf false" set before checkout:

  > git config --global core.autocrlf false
  > git clone https://github.com/openssl/openssl
like image 2
nredko Avatar answered Nov 14 '22 20:11

nredko


This article has vetted some of the weirdness of building OpenSSL with Visual Studio:

http://developer.covenanteyes.com/building-openssl-for-visual-studio/

like image 1
Elliot Cameron Avatar answered Nov 14 '22 21:11

Elliot Cameron