Trying to compile the basic compression library into an x86 lib and keep failing

nope no 65 Reputation points
2023-06-07T19:00:12.86+00:00

LIBCMT.lib(chkstk.obj) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

is the error in question

here's the command line and flags:

CC = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\SDK\ScopeCppSDK\vc15\VC\bin\CL.exe"
CFLAGS = -D_WIN32 -DDEBUG /c /nologo /GR /GX /W3 /Gy /MT /Zi

I'm trying to compile it for x86. I've also tried using vssalsx86.bat to change the environment, but that doesn't work. Neither does using the x86 native tools compiler command line, and tried the /machine option but every time i do it says "invalid option m"

Any ideas?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,806 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 40,946 Reputation points
    2023-06-08T10:02:27.5966667+00:00

    Using VS2019 Community I did a command line compile using CL.exe from several of the Visual Studio command prompts (Developer, x86 Native Tools, x64 Native Tools and x64_x86 Cross Tools. In each case, the VS command prompt environment was properly configured to execute the appropriate compiler and linker to produce executables for the target architecture. The images below show the command prompts used and the logging by Procmon.exe demonstrating the full path to the compilers and linkers executed.

    I therefore believe that your issue is caused by the makefile being used and reiterate my suggestion to not code hard paths to the compiler and linker if you are building from one of the VS command prompts to target x86.

    Developer Command Prompt -

    Developer Command Prompt

    Procmon Developer Command Prompt

    x86 Native Tools Command Prompt -

    x86 Native Tools Command Prompt

    Procmon x86 Native Tools Command Prompt

    x64_x86 Cross Tools Command Prompt -

    x64_x86 Cross Tools Command Prompt

    Procmon x64_x86 Cross Tools Command Prompt

    x64 Native Tools Command Prompt -

    x64 Native Tools Comand Prompt

    Procmon x64 Native Tools Comand Prompt

    0 comments No comments

  2. nope no 65 Reputation points
    2023-06-09T16:57:45.39+00:00

    Yes. their presence or absence only determines which cl and which lib are used. this was an accidental dupe, i'm closing this question.

    0 comments No comments