Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Unable to build standalone executable on Windows 7, Qt5.3.1
Forum Updated to NodeBB v4.3 + New Features

Unable to build standalone executable on Windows 7, Qt5.3.1

Scheduled Pinned Locked Moved Installation and Deployment
23 Posts 2 Posters 10.9k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    blu083
    wrote on last edited by
    #7

    And then when running in VS2013 x64 Native Tools Command Prompt:

    Same input.

    Output:
    @
    .obj\release\qmalloc.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

    return code '0x458
    @

    1 Reply Last reply
    0
    • B Offline
      B Offline
      blu083
      wrote on last edited by
      #8

      [quote author="SGaist" date="1410216345"]Did you forget to confclean before reconfiguring ? You should consider doing an out of source build so if something goes wrong you can simply delete and restart.[/quote]

      Yes, I did, trying that now. Can you provide the command line syntax for an 'out of source' build? I'm unclear on where I can specify source code path and then output path.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #9

        Looks like you didn't clean before re-configuring

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • B Offline
          B Offline
          blu083
          wrote on last edited by
          #10

          Sorry, can you tell me how to clean? Something seems different in qt5.

          It no longer seems to be:
          @
          make confclean
          @

          run from that same directory.

          http://stackoverflow.com/questions/6067271/qt-when-builing-qt-from-source-how-do-i-clean-old-configure-configurations

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #11

            pseudo bash:

            @
            C:\Users\me\Desktop
            mkdir build_qt5
            cd build_qt5
            ..\qt-everywhere-opensource-src-5.3.1\configure -release -static -nomake examples -nomake demos
            @

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blu083
              wrote on last edited by
              #12

              I'm unable to build. Trying to be very explicit about my process. Things terminate with error U1077.

              This post seems to suggest something along the lines of a bad example or needing to disable my antivirus?
              http://stackoverflow.com/questions/10356198/error-when-compiling-qt-nmake-fatal-error-u1077

              @

              Open VS2013 x64 Native Tools Command Prompt

              Install perl, git, python, ruby

              Perl

              Git

              Python

              [Ruby](1.9.3 http://www.rubyinstaller.org/downloads/

              Restart command prompt (and potentially machine) and ensure

              these all now exist in your PATH variable

              perl --version
              git --version
              python --version
              ruby --version

              Make separate directories for the source and build

              cd \Users\blu083\Desktop
              mkdir qt5source
              mkdir qt5build

              cd qt5source
              git clone https://github.com/qtproject/qt5.git
              // May have to move folders around
              git checkout 5.3.1
              perl init-repository

              Clean any potential previous configuration

              cd \Users\blu083\Desktop\qt5source
              git submodule foreach --recursive "git clean -dfx"

              Create the config file

              cd \Users\blu083\Desktop\qt5build
              C:\Users\blu083\Desktop\qt5source\configure -release -opensource -static -nomake examples

              Compile to the build directory

              cd \Users\blu083\Desktop\qt5build
              nmake
              ...
              mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "......\bin\moc.exe". The operation failed.
              NMAKE : fatal error U1077: '"C:\Program Files (x86)\Windows Kits\8.1\bin\x64\mt.exe"' : return code '0x1f'
              @

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #13

                Indeed, depending on which anti-virus you have on your computer, it may interfere with the creation of executable files.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  blu083
                  wrote on last edited by
                  #14

                  Woo hoo! Turning off my antivirus and running as administrator did it.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #15

                    You shouldn't need to run it as admin. Standard user should be enough to build and run.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      blu083
                      wrote on last edited by
                      #16

                      Continuing with the directions here: https://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows

                      It's unclear where I place the static build. At the highest level of my application? I also get stopped again by the following error in my process. Note that my PATH variable does NOT have a path to qmake, so I put in the full path to be more explicit about everything. I may end up needed an absolute path to mt.exe as well:

                      @

                      Open VS2013 x64 Native Tools Command Prompt

                      cd \Users\blu083\Desktop\MyQtProject\MyProjectApp
                      C:\Qt\5.3\msvc2013_64\bin\qmake MyApp.pro
                      nmake release
                      error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in MainWindow.obj
                      cd release
                      mt.exe -manifest MyApp.exe.manifest -outputresource: MyApp.exe;1
                      @

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #17

                        Simple, you don't move a build

                        Did you cleanup your project before running qmake ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          blu083
                          wrote on last edited by
                          #18

                          Yes. But I still don't understand how are my built libraries found. Will these now conflict with files under @C:\Qt@ directory? Can I delete the qt5build directory from my desktop?

                          I am now getting problems where I cannot build a release via QtCreator:
                          @
                          MSVCRT.lib(MSVCR120.dll):-1: error: LNK2005: memmove already defined in LIBCMT.lib(memcpy.obj)
                          MSVCRT.lib(MSVCR120.dll):-1: error: LNK2005: free already defined in LIBCMT.lib(free.obj)
                          MSVCRT.lib(MSVCR120.dll):-1: error: LNK2005: malloc already defined in LIBCMT.lib(malloc.obj)
                          ...
                          qtmain.lib(qtmain_win.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in Settings.obj
                          ...
                          LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
                          @

                          This problem only seems to exist on the PC on which I did a static build. A new PC, that I just downloaded Qt5.3 onto does NOT get these errors.

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #19

                            Did you by any chance modify Qt's sources to link against Visual Studio's static run time ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              blu083
                              wrote on last edited by
                              #20

                              I followed the directions as closely as I could. My steps are explicitly documented in this thread. I, I don't know what to do anymore. I think I'm going to build chrome apps.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #21

                                That part doesn't show anywhere in the thread, that's why I'm asking this. If you didn't touch Qt's sources then you should be linking to the dynamic c++ runtime (which is a good thing).

                                So the question is, are you setting the MT flag anywhere in your project ? If so then please remove it.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • B Offline
                                  B Offline
                                  blu083
                                  wrote on last edited by
                                  #22

                                  I've searched the overarching .pro and the two sub project .pro files (one I never touch and is an HIDAPI project). None of them make any reference to an MT flag (I'm still searching around for what that flag is and how it could've been set). Here are the contents of my .pro files:

                                  @
                                  TEMPLATE = subdirs
                                  CONFIG += ordered
                                  CONFIG += static

                                  SUBDIRS =
                                  HIDAPI
                                  Bootloader
                                  @

                                  @
                                  TARGET = "MyApp"
                                  TEMPLATE = app
                                  QT += sql
                                  QT += widgets
                                  QMAKE_CXXFLAGS_RELEASE = -Os
                                  INCLUDEPATH += ../
                                  SOURCES +=
                                  MainWindow.cpp
                                  main.cpp
                                  Dummy.cpp
                                  HEADERS +=
                                  MainWindow.h
                                  Dummy.h

                                  FORMS += MainWindow.ui
                                  RESOURCES += resources.qrc
                                  OTHER_FILES += windows.rc

                                  #-------------------------------------------------------------------------------

                                  Add the correct HIDAPI library according to what OS is being used

                                  #-------------------------------------------------------------------------------
                                  win32: LIBS += -L../HIDAPI/windows
                                  macx: LIBS += -L../HIDAPI/mac
                                  unix: !macx: LIBS += -L../HIDAPI/linux
                                  LIBS += -lHIDAPI

                                  #-------------------------------------------------------------------------------

                                  Make sure to add the required libraries or frameworks for the hidapi to work

                                  depending on what OS is being used

                                  #-------------------------------------------------------------------------------
                                  macx: LIBS += -framework CoreFoundation -framework IOkit
                                  win32: LIBS += -lSetupAPI
                                  unix: !macx: LIBS += -lusb-1.0

                                  #-------------------------------------------------------------------------------

                                  Make sure output directory for object file and executable is in the correct

                                  subdirectory

                                  #-------------------------------------------------------------------------------
                                  macx {
                                  DESTDIR = mac
                                  OBJECTS_DIR = mac
                                  MOC_DIR = mac
                                  UI_DIR = mac
                                  RCC_DIR = mac
                                  }
                                  unix: !macx {
                                  DESTDIR = linux
                                  OBJECTS_DIR = linux
                                  MOC_DIR = linux
                                  UI_DIR = linux
                                  RCC_DIR = linux
                                  }
                                  win32 {
                                  DESTDIR = windows
                                  OBJECTS_DIR = windows
                                  MOC_DIR = windows
                                  UI_DIR = windows
                                  RCC_DIR = windows
                                  }
                                  @

                                  @

                                  -------------------------------------------------

                                  Project created by QtCreator 2010-10-29T15:54:07

                                  -------------------------------------------------

                                  QT -= gui
                                  TARGET = HIDAPI
                                  TEMPLATE = lib
                                  CONFIG += staticlib
                                  HEADERS += hidapi.h

                                  -------------------------------------------------

                                  Add appropriate source file depending on OS

                                  -------------------------------------------------

                                  macx: SOURCES += mac/hid.c
                                  unix: !macx: SOURCES += linux/hid-libusb.c
                                  win32: SOURCES += windows/hid.cpp

                                  -------------------------------------------------

                                  Make sure output directory for object file and

                                  library is in the correct subdirectory

                                  -------------------------------------------------

                                  macx {
                                  DESTDIR = mac
                                  OBJECTS_DIR = mac
                                  MOC_DIR = mac
                                  UI_DIR = mac
                                  RCC_DIR = mac
                                  }
                                  unix: !macx {
                                  DESTDIR = linux
                                  OBJECTS_DIR = linux
                                  MOC_DIR = linux
                                  UI_DIR = linux
                                  RCC_DIR = linux
                                  }
                                  win32 {
                                  DESTDIR = windows
                                  OBJECTS_DIR = windows
                                  MOC_DIR = windows
                                  UI_DIR = windows
                                  RCC_DIR = windows
                                  }
                                  @

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #23

                                    Did you also compile your dependencies yourself ?

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0

                                    • Login

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