James
James

Reputation: 187

OpenSSL fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64

I'm encountering a very frustrating error while trying to build OpenSSL on Windows 10. The error I get is

"lib" /nologo /out:providers\libdefault_static.lib @C:\Users\jcava\AppData\Local\Temp\nmF1AF.tmp
providers\common\libdefault-lib-bio_prov.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64

The steps I'm doing are running perl Configure VC-WIN64A then nmake both within the openssl directory that I cloned from Github. Im running all of this within a x64 command line prompt for VS 2019.

Cheers, James

Upvotes: 10

Views: 4642

Answers (3)

Michael Walton
Michael Walton

Reputation: 411

I encountered the same error using Visual Studio Community 2022. Maybe I'm blind, but I couldn't find a x64 Native Tools Command Prompt anywhere.

For anyone who finds their way here and is using VSC2022: you can use the Developer Command Prompt and run C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat before building OpenSSL v3.1.0. Of course, your vcvars64.bat might be installed elsewhere.

And yes as others suggested, I had to remove the files from the previous failed builds. I just used nmake clean.

And if you're building 32-bit versions, there's an equivalent vcvars32.bat script.

Upvotes: 4

Chad Hedgcock
Chad Hedgcock

Reputation: 11755

For x64 you have to run your perl Configure and nmake commands from x64 Native Tools Command Prompt for VS 201x, not the Developer Command Prompt for VS 201x.

You can search for it in your Windows search bar. Make sure to right click it and run it in administrator mode.

If you've already compiled it incorrectly, you probably have to delete openssl and clone it again. Deleting the .obj files didn't solve it for me.

Source

Upvotes: 17

RMac
RMac

Reputation: 51

I had similar problem. It means that there are some object files that have been compiled already using x86 (in this case). Perhaps you started off using the x86 compiler.

If you delete all the object files (type del /S *.obj in your openssl directory) then run nmake again it should compile fine.

Alternatively you could re-clone the repository and start again.

Upvotes: 5

Related Questions