Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Module machine type 'x64' conflicts with target machine type 'x86'

Module machine type 'x64' conflicts with target machine type 'x86'

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniella
    wrote on 3 Jun 2023, 11:23 last edited by Daniella 6 Mar 2023, 15:40
    #1

    I'm trying to compile a c++ Qt dll "Qt Class Library" on Visual Studio 22, I'm testing with a clean project, it does compile correctly on x64 but when I try the x86 version I'm getting this error:

    Severity	Code	Description	Project	File	Line	Suppression State
    Error	LNK1112	module machine type 'x64' conflicts with target machine type 'x86'	C:\Qt\Static\Debug\lib\objects-Debug\QWindowsIntegrationPlugin_resources_1\.rcc\qrc_openglblacklists.cpp.obj	1
    

    I'm compiling the dll with the Qt source compiled as static using the "x64 Native Tools Command Prompt for VS 2022" and this command:

    configure.bat -static -debug -platform win32-msvc -opensource -confirm-license -skip qtwebengine -prefix "C:\Qt\Static\Debug"

    d9d0f9d9-e14b-43bf-90b2-1385797d55c7-image.png

    I'm not sure which of these to use, then I compiled the source again.

    When i compile the source using:
    x64_x86 Native Tools Command Prompt for VS 2022

    It compile the x86 version of the dll, but the x64 version throw the machine type error.

    x86_x64 Native Tools Command Prompt for VS 2022

    It compile the x64 version of the dll, but the x86 version throw the machine type error.

    I'm confused, is this correct? I really need to have two different builds of the source? one compiled with the x64 Native Tools and another with the x86 Native Tools? Isn't possible to have it built only once and work with both versions?

    Is -platform win32-msvc the correct option when building the Qt source?

    C 1 Reply Last reply 3 Jun 2023, 15:42
    0
    • D Daniella
      3 Jun 2023, 15:55

      @Chris-Kawa are you sure -static works with -debug-and-release? i remember to try it once and it didn't work (maybe i did something wrong)

      C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 3 Jun 2023, 15:57 last edited by
      #4

      @Daniella It should, but I haven't checked. If it doesn't you can build them separately, once for debug and once for release, but in any case you should have a Debug build for debugging and Release build for, well, releasing :)

      D 1 Reply Last reply 3 Jun 2023, 18:00
      1
      • D Daniella
        3 Jun 2023, 11:23

        I'm trying to compile a c++ Qt dll "Qt Class Library" on Visual Studio 22, I'm testing with a clean project, it does compile correctly on x64 but when I try the x86 version I'm getting this error:

        Severity	Code	Description	Project	File	Line	Suppression State
        Error	LNK1112	module machine type 'x64' conflicts with target machine type 'x86'	C:\Qt\Static\Debug\lib\objects-Debug\QWindowsIntegrationPlugin_resources_1\.rcc\qrc_openglblacklists.cpp.obj	1
        

        I'm compiling the dll with the Qt source compiled as static using the "x64 Native Tools Command Prompt for VS 2022" and this command:

        configure.bat -static -debug -platform win32-msvc -opensource -confirm-license -skip qtwebengine -prefix "C:\Qt\Static\Debug"

        d9d0f9d9-e14b-43bf-90b2-1385797d55c7-image.png

        I'm not sure which of these to use, then I compiled the source again.

        When i compile the source using:
        x64_x86 Native Tools Command Prompt for VS 2022

        It compile the x86 version of the dll, but the x64 version throw the machine type error.

        x86_x64 Native Tools Command Prompt for VS 2022

        It compile the x64 version of the dll, but the x86 version throw the machine type error.

        I'm confused, is this correct? I really need to have two different builds of the source? one compiled with the x64 Native Tools and another with the x86 Native Tools? Isn't possible to have it built only once and work with both versions?

        Is -platform win32-msvc the correct option when building the Qt source?

        C Offline
        C Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on 3 Jun 2023, 15:42 last edited by Chris Kawa 6 Mar 2023, 15:54
        #2

        @Daniella said:

        I'm confused, is this correct? I really need to have two different builds of the source?

        Yes, 32bit and 64bit builds require different compilers and toolchains.
        x64 Native Tools Command Prompt for VS 2022 opens a command line that sets up the environment for producing 64bit binaries.
        x86 Native Tools Command Prompt for VS 2022 opens a command line that sets up the environment for producing 32bit binaries.

        Also, when you want to compile to x64 and x86 -platform win32-msvc is the correct option when building the Qt source?

        Yes. The name is confusing but that's just 30 years of legacy naming shenanigans for you :) These days win32 pretty much just means Windows API. It' for all architectures - x86, AMD64, ARM and whatnot.

        Will it work for x64 and x86?

        Yes, it will work for both 32 and 64 bit builds. The choice between 32 and 64 bit build is done through the environment setup mentioned above.

        Isn't possible to have it built only once and work with both versions?

        No. These are different architectures. The binaries produced for 32bit and 64bit are different and incompatible. You can't mix 32 and 64 bit dlls and exes.
        If you want to have one set of binaries you can just produce 32bit version if that's ok for you. 64bit Windows can run both 32 and 64bit apps. But if you're targeting modern Windows check if you really need 32bit support at all. Most consumer PCs have a 64bit OS these days.

        The x64_x86 and x86_x64 are cross-compilers, meaning that a 64 bit compiler will produce 32 bit binary or the other way around. There's usually no need to use it. You might need it if you're on a 32 bit system and need to produce 64 bit binaries or if your compilation is so big that you require 64 bit compiler to produce the 32 bit version e.g. due to memory limit issue. If you're not in those cases just use the regular x64 or x86 versions, not cross-compilers.

        Also - are you sure you only want the Debug version? At some point you'll finish your app and want to distribute it. You shouldn't be distributing Debug builds. They are big and slow. Consider building both debug and release versions by passing -debug-and-release option to configure.

        D 1 Reply Last reply 3 Jun 2023, 15:55
        1
        • C Chris Kawa
          3 Jun 2023, 15:42

          @Daniella said:

          I'm confused, is this correct? I really need to have two different builds of the source?

          Yes, 32bit and 64bit builds require different compilers and toolchains.
          x64 Native Tools Command Prompt for VS 2022 opens a command line that sets up the environment for producing 64bit binaries.
          x86 Native Tools Command Prompt for VS 2022 opens a command line that sets up the environment for producing 32bit binaries.

          Also, when you want to compile to x64 and x86 -platform win32-msvc is the correct option when building the Qt source?

          Yes. The name is confusing but that's just 30 years of legacy naming shenanigans for you :) These days win32 pretty much just means Windows API. It' for all architectures - x86, AMD64, ARM and whatnot.

          Will it work for x64 and x86?

          Yes, it will work for both 32 and 64 bit builds. The choice between 32 and 64 bit build is done through the environment setup mentioned above.

          Isn't possible to have it built only once and work with both versions?

          No. These are different architectures. The binaries produced for 32bit and 64bit are different and incompatible. You can't mix 32 and 64 bit dlls and exes.
          If you want to have one set of binaries you can just produce 32bit version if that's ok for you. 64bit Windows can run both 32 and 64bit apps. But if you're targeting modern Windows check if you really need 32bit support at all. Most consumer PCs have a 64bit OS these days.

          The x64_x86 and x86_x64 are cross-compilers, meaning that a 64 bit compiler will produce 32 bit binary or the other way around. There's usually no need to use it. You might need it if you're on a 32 bit system and need to produce 64 bit binaries or if your compilation is so big that you require 64 bit compiler to produce the 32 bit version e.g. due to memory limit issue. If you're not in those cases just use the regular x64 or x86 versions, not cross-compilers.

          Also - are you sure you only want the Debug version? At some point you'll finish your app and want to distribute it. You shouldn't be distributing Debug builds. They are big and slow. Consider building both debug and release versions by passing -debug-and-release option to configure.

          D Offline
          D Offline
          Daniella
          wrote on 3 Jun 2023, 15:55 last edited by Daniella 6 Mar 2023, 15:56
          #3

          @Chris-Kawa are you sure -static works with -debug-and-release? i remember to try it once and it didn't work (maybe i did something wrong)

          C 1 Reply Last reply 3 Jun 2023, 15:57
          0
          • D Daniella
            3 Jun 2023, 15:55

            @Chris-Kawa are you sure -static works with -debug-and-release? i remember to try it once and it didn't work (maybe i did something wrong)

            C Offline
            C Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on 3 Jun 2023, 15:57 last edited by
            #4

            @Daniella It should, but I haven't checked. If it doesn't you can build them separately, once for debug and once for release, but in any case you should have a Debug build for debugging and Release build for, well, releasing :)

            D 1 Reply Last reply 3 Jun 2023, 18:00
            1
            • D Daniella has marked this topic as solved on 3 Jun 2023, 16:09
            • C Chris Kawa
              3 Jun 2023, 15:57

              @Daniella It should, but I haven't checked. If it doesn't you can build them separately, once for debug and once for release, but in any case you should have a Debug build for debugging and Release build for, well, releasing :)

              D Offline
              D Offline
              Daniella
              wrote on 3 Jun 2023, 18:00 last edited by Daniella 6 Mar 2023, 18:02
              #5

              @Chris-Kawa I have compiled the source as configure.bat -static -debug-and-release -platform win32-msvc -opensource -confirm-license -skip qtwebengine -prefix "C:\Qt\Static\x64_DebugAndRelease" and then cmake --install .

              Its working on release but not on debug, the folder is only 1.4gb i think it didn't installed the debug things, i'm also not finding the .pdbs in the x64_DebugAndRelease folder but i can see them into the source folder, do you know if i need any additional command when installing it?

              C 1 Reply Last reply 3 Jun 2023, 18:19
              0
              • D Daniella
                3 Jun 2023, 18:00

                @Chris-Kawa I have compiled the source as configure.bat -static -debug-and-release -platform win32-msvc -opensource -confirm-license -skip qtwebengine -prefix "C:\Qt\Static\x64_DebugAndRelease" and then cmake --install .

                Its working on release but not on debug, the folder is only 1.4gb i think it didn't installed the debug things, i'm also not finding the .pdbs in the x64_DebugAndRelease folder but i can see them into the source folder, do you know if i need any additional command when installing it?

                C Offline
                C Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on 3 Jun 2023, 18:19 last edited by
                #6

                @Daniella cmake --install . will only install the release part of the build. Run cmake --install . --config Debug after that to also install the debug part.

                1 Reply Last reply
                1

                1/6

                3 Jun 2023, 11:23

                • Login

                • Login or register to search.
                1 out of 6
                • First post
                  1/6
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved