OpenSSL 1.1 Cannot Build x64

Asked 2 years ago, Updated 2 years ago, 79 views

Error when building OpenSSL 1.1 from the command line in Windows 10 (x64).
The x86 build will pass, but what is the cause?
When LNK1112 occurs, the properties of the solution show how to change the target computer, but can I change this setting from the command line?

Please let me know.

■ Symptom
After perl generates makefile, nmake encountered an error.
Error Message

cl  /Zi /Fdossl_static.pdb /Gs0 /GF /Gy /MD /W3 /wd4090 /nologo /O2 /I "." /I "crypto\include" /I "include" /I "crypto" -D"L_ENDIAN" -D"OPENSSL_PIC" -D"OPENSSLDIR=\"C:\\Program Files\\Common Files\\SSL\"" -D"ENGINESDIR=\"C:\\openssl\\build\\win\\x64\\lib\\engines-1_1\"" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE" -D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE" -D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"OPENSL_USE_APPLINK" -D"NDEBUG"/Zs/showIncludes"crypto\cversion.c"2>1>crypto\cversion.d
        IF EXIST.manifest DEL/F/Q.manifest
        IF EXIST libcrypto-1_1-x64.dll DEL/F/Q libcrypto-1_1-x64.dll
        link/nologo/debug/dll/nologo/debug/implib:libcrypto.lib/out:libcrypto-1_1_1-x64.dll/def:libcrypto.def@C:\Users\XXXXXXX\AppData\Local\Temp\nm5483.tmp|(DEL/Qcrypto-1_1.x64o;xipo;EXPrimp;x64o&def:lib &Exp)
US>crypto\cversion.obj: fatal error LNK1112: Module computer type 'x64' conflicts with target computer type 'x86'.

■Environment
VC2019 Perl v5.28.1
Build target Ver.OpenSSL 1.1.1d

■ Build Commands
build.bat

set PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxillary\Build; %PATH%
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxillary\Build\vcvarsx86_amd64.bat"
Rem vcvars64.bat gets the same error

perl Configure no-asm -- prefix=C:/opensl/build/win/x64 VC-WIN64A

nmake install

openssl

2022-09-30 15:57

2 Answers

Self-resolved.

After x86 build, the x86 object link failed because it was built with the garbage file left.
Build successful after redeploying OpenSSL tgz


2022-09-30 15:57

I understand that it is self-solving, but I would like to add a supplement.

You can separate the source and build trees.For example, creating each build-x86/build-x64 directory can prevent the generated files from being crossed.

 mkdir build-x64
cd build-x64
perl..\Configure no-asm -- prefix=C:/opensl/build/win/x64 VC-WIN64A
nmake install
cd..

Also, the openssl repository contains appveyor.yml, which is helpful.

mkdir_build
cd_build
perl..\Configure VC-WIN64A-masm no-madepend
nmake build_all_generated
nmake PERL = no-perl
cd..

and so on.


2022-09-30 15:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.