One thing to check is if you do a 32-bit build first, then a 64-bit build.
OpenSSL unfortunately does not support a "parallel build tree" as well as
other libraries.  For non-Windows, there's a script that will create a
sibling directory, and then make soft links for all the files.

What I end up doing for all the platforms is just having a complete copy of
the tree for a given target at build-time (i.e., Windows-Win32, Windows-x64,
MacOSX-x64, etc.).

For Windows, I also make some customizations to ms\ntdll.mak after the perl
configure and do_win64a.bat, and before nmake.  I also reference my own
build of zlib for Windows.

Here's the script I use (Build-Windows-x64.bat). You can take out the things
that don't apply.  This will open ms\ntdll.mak in notepad, so you can make
some tweaks, then once you save and close Notepad, it will go on.

---------------------------------
:: NOTE: Make sure:
::  1. Perl (ActivePerl from ActiveState) is installed, and is in the path
::  OLD 2: Note that VS 2010 has "ml" (and ml64), so we don't need MASM
itself to run the "do_masm.bat"
::  NEW 2: OpenSSL on Windows wants NASM (nasm.sourceforge.net). Install
that and put it in the path.
::  3. Paths need to be "backwards" for windows, because they are used when
buliding up C++ code, as well as in other places.
::     (c:/my/path instead of c:\my\path)
::  4. For debug configuration, copy do_nasm and friends and make "_debug"
version - find "mk1mf.pl", and add "debug" before VC-WIN32
::  5. Be sure to run this under a "VS 2010 x64 Command Line".
::  6. For the x64 build, there's trouble getting it to compile on Windows
Server 2010 x64.
::     On 32-bit XP (with DXSDK and Windows SDK installed), it gets farther,
but ran into
::     link error with bufferoverflowu.lib. That turned out to be a PSDK
library (to support /GS),
::     and it looks like it wasn't found in any of the LIB paths.  There was
one LIB path that
::     wasn't in the list. So, before running any of this, update the LIB
path:
::           set LIB=%LIB%;C:\Program Files\Microsoft Visual Studio
10\VC\PlatformSDK\Lib\AMD64
::  7. Output will go into out64dll

:: ThirdParty (for zlib)
pushd ..\..\..
set THIRD_PARTY_FULLPATH_FS=%CD:\=/%
popd

if "%OPENSSL_ROOT%" == "" set OPENSSL_ROOT=openssl-1.0.1e

rmdir /s %OPENSSL_ROOT%-x64
xcopy /s /e %OPENSSL_ROOT% %OPENSSL_ROOT%-x64\

pushd %OPENSSL_ROOT%-x64

:: FS == Forward slashes
set OPENSSL_ROOT_FULLPATH_FS=%CD:\=/%

perl Configure VC-WIN64A zlib enable-static-engine
--prefix="%OPENSSL_ROOT_FULLPATH_FS%/redist_x64"
-I"%THIRD_PARTY_FULLPATH_FS%/include/zlib"
-L"%THIRD_PARTY_FULLPATH_FS%/lib/Windows-x64/Release/zlib"

call ms\do_win64a.bat

@echo off

echo Please edit the ms\ntdll.mak and:
echo  - Add /Zi to the compiler flags (if not already there is APP_CFLAG and
LIB_CFLAG)
echo  - Add -DZLIB_WINAPI to the compiler flags (after -DZLIB)
echo  ??? - Change /Ox to /Os in the compiler flags (maybe just leave it as
/Ox for now)
echo  - Add /DEBUG to the linker flags (to the front)
echo  - Add zlib1.lib to the linker flags (to the end)
echo  - Rename tmp32dll to tmp64dll
echo  - Rename out32dll to out64dll
echo  - Find the "final link" that reference O_SSL then O_CRYPTO. Search for
$(O_SSL): $(SSLOBJ)
echo  - For O_SSL add to the final link /DEBUG /PDB:$(OUT_D)/$(SSL).pdb
echo  - For O_SSL, add the /libpath: for zlib from earlier
echo  - For O_CRYPTO add to the final link /DEBUG
/PDB:$(OUT_D)/$(CRYPTO).pdb
echo  - For O_CRYPTO, add the /libpath: for zlib from earlier
echo  Then hit any key to continue

notepad ms\ntdll.mak

pause

@echo on

nmake -f ms\ntdll.mak

nmake -f ms\ntdll.mak test

nmake -f ms\ntdll.mak install

popd
---------------------------------


-Daniel

-----Original Message-----
From: owner-openssl-us...@openssl.org
[mailto:owner-openssl-us...@openssl.org] On Behalf Of Andrew MARLOW
Sent: Monday, July 08, 2013 3:00 AM
To: openssl-users@openssl.org
Cc: marlow.age...@gmail.com
Subject: Building on Windows in 64 bit mode

Hello gentlemen,

I am trying to build openssl 1.0.1e on windows and am running into a few
problems. I hope someone will be able to help/advise.

Following the instructions in INSTALL.W32 seems to work for 32 bit release
mode but not for other combinations. Switching from Release to Debug does
not result in the pdb files being installed via the command nmake -f
ms\ntdll.mak install.

I tried to build in 64 bit by running vcvarsall amd64 then following the
build steps. The compilations were successful, with a few warnings about
conversions, but I got a linktime error:

       rc /fo"tmp32dll\libeay32.res" /d CRYPTO ms\version32.rc
       link /nologo /subsystem:console /opt:ref /debug /dll
/out:out32dll\libeay32.dll /def:ms/LIBEAY32.def
@C:\Users\marlowa\AppData\Local\Temp\nmEFE4.tmp
mp32dll\x86cpuid.obj : fatal error LNK1112: module machine type 'X86'
conflicts with target machine type 'x64'
MAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
8\VC\BIN\amd64\link.EXE"' : return code '0x458'
Stop.

I am on windows 7 (64 bit) using the Visual Studio 2005 compiler.

Googling, I see that others have hit this problem as well:

http://comments.gmane.org/gmane.comp.encryption.openssl.devel/16256
http://stackoverflow.com/questions/2559358/fatal-error-lnk1112-module-machin
e-type-x86-conflicts-with-target-machine-typ
http://stackoverflow.com/questions/14704592/fatal-error-lnk1112-module-machi
ne-type-x86-conflicts-with-target-machine-typ

It looks to me like the 64 bit build is using some components that came out
of the 32 bit build, but I am not sure.

Regards,

Andrew Marlow



___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and delete this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is prohibited.

Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for
additional disclosures.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to