2

First of all, to prevent duplicate reports I have tried multiple solutions given here, here, here, here and here.

I am using Qt 5.5.1 with Visual Studio 2012 and developed my app on Windows 10 x64 (not using Qt Creator). Application is compiled in release mode.

Actually, my application is working on my PC, without any issues and the only libraries I need in my directory are:

Qt5Core.dll
Qt5Gui.dll
Qt5WinExtras.dll
Qt5Widgets.dll
Qt5Network.dll
msvcp110.dll
msvcr110.dll

Now, when I try to launch my application on fresh installation of Windows 7 x86 I am getting the following error message:

This application failed to start because it could not find or load the Qt platform plugin "windows".

Reinstalling the application may fix this problem.

Now I can't get rid of it. According to the previously asked questions it can be a issue with qwindows.dll file (or more precisely with application couldn't locate it), first of all I made a deploy of my release directory like this:

[..]\msvc2012\bin>windeployqt.exe <PATH>

It has generated all files that are needed for my application to launch, including platforms/qwindows.dll so I have simply copied all of them to Windows 7 directory without any effect - error still occurs.

I have also tried to manually copy a qwindows.dll from the msvc2012\plugins\platforms - no effect,

Last step I did was a inspection of my application in the Dependency Walker - suprisingly, there is no qwindows.dll related dependency:

image

So I am out of ideas now, what is the problem here?

Community
  • 1
  • 1
RA.
  • 969
  • 13
  • 36
  • It wouldn't show as a dependency but it is nonetheless. Did you put it in a `platforms` folder relative to the executable? – dtech Oct 19 '16 at 20:58
  • @ddriver Yes, been trying multiple ways, including defining path within `qt.conf`. – RA. Oct 19 '16 at 21:00
  • "I have simply copied all of them to Windows 7": where exactly in Windows 7 did you copy the files? – rocambille Oct 19 '16 at 21:00
  • @wasthishelpful Well, it doesn't matter since my application `.exe` was there, so it could be on desktop folder or documents. Important thing is that the structure is the same. `http://i.imgur.com/k91bYHg.png` – RA. Oct 19 '16 at 21:06
  • My question was to know if you copied the deployed files into the sytem directory instead of the executable directory, and that matters. Your sentence was ambiguous, so my question. Sorry for trying to help – rocambille Oct 19 '16 at 21:14
  • Dependency Walker can also be used to *profile* an application (not just a static analysis of modules). It displays (or used to anyway, when it was still supported) which libraries were attempted to load. If that doesn't lead anywhere, try [Process Monitor](https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx) to find out, which binaries were attempted to be loaded. – IInspectable Oct 19 '16 at 21:18
  • Also make sure, that all DLLs have the correct bitness. A quick way to check is with dumpbin (running the following from a Developer Command Prompt: `for /R %f in (*.dll) do (dumpbin /headers "%f" | findstr "machine")`). – IInspectable Oct 19 '16 at 21:31
  • 1
    ... could you please edit your question and add all the files that were deployed? (And by that I mean the exact directory structure) – peppe Oct 19 '16 at 21:34
  • Are you perchance deploying to a virtual machine? I had troubles getting QML to work until I found `opengl32sw.dll` in Qt Creator's files. – krzaq Oct 19 '16 at 21:36
  • @krzaq No, I'm not using QML anyways. – RA. Oct 19 '16 at 21:52
  • @IInspectable Process Monitor log till error occurs: http://i.imgur.com/nmjthOu.png – RA. Oct 19 '16 at 22:01
  • That process exit code is `0xC0000005`, i.e. an Access Violation. Have you tried running it under a debugger on the Windows 7 machine? Are you using OS features that were introduced in Windows after Windows 7? What's the value of your [`_WIN32_WINNT`](https://msdn.microsoft.com/en-us/library/6sehtctf.aspx) preprocessor symbol? – IInspectable Oct 19 '16 at 22:25
  • @IInspectable Actually your comment gave me an idea, I made a special compilation of debug version and turns out that apparently a `qFatal()` is being called (which means abort()). I have logged this and this time abort gave an extra info: `[FATAL]: This application failed to start because it could not find or load the Qt platform plugin "windows". Reinstalling the application may fix this problem.(kernel\qguiapplication.cpp:1038 - void __cdecl init_platform(const class QString &,const class QString &,const class QString &,int &,char **))` – RA. Oct 19 '16 at 22:59
  • That's not much additional information. It's basically the same you had in your question all along: The *"windows"* plugin could not be loaded (which happens to be needed for `init_platform`). So again, have you checked the bitness of the *qwindows.dll* as well as the bitness of all of its dependencies? All it takes is a single 32-bit DLL to keep an entire 64-bit application from starting (or vice versa). – IInspectable Oct 19 '16 at 23:07
  • @IInspectable The bitness of all of the dependencies generated by windeploy are the same: `14C machine (x86) 32bit word machine` – RA. Oct 20 '16 at 12:39
  • Did profiling the application using Dependency Walker produce any insights? (See [Using Application Profiling to Detect Dynamic Dependencies](http://www.dependencywalker.com/help/html/application_profiling.htm).) – IInspectable Oct 20 '16 at 12:43
  • @IInspectable I did. http://i.imgur.com/IBcgJuN.png – RA. Oct 20 '16 at 13:20

1 Answers1

0

This is what I do to deploy QOwnNotes (Qt5) under Windows: https://github.com/pbek/QOwnNotes/blob/develop/appveyor.yml

# AppVeyor build configuration
# http://www.appveyor.com/docs/build-configuration
os: unstable
skip_tags: true

install:
- set QTDIR=C:\Qt\5.5\mingw492_32
- set PATH=%PATH%;%QTDIR%\bin;C:\MinGW\bin
- set RELEASE_PATH=appveyor\release

before_build:
# getting submodules
- git submodule update --init

build_script:
# using a header file without MemoryBarrier, that causes the build to fail
- copy appveyor\qopenglversionfunctions.h %QTDIR%\include\QtGui
# workaround for MinGW bug
- sed -i s/_hypot/hypot/g c:\mingw\include\math.h
- cd src
# we need to modify that to make it running on AppVeyor
- sed -i "s/CONFIG += c++11/QMAKE_CXXFLAGS += -std=gnu++0x/g" QOwnNotes.pro
- "echo #define RELEASE \"AppVeyor\" > release.h"
# setting the build number in the header file
- "echo #define BUILD %APPVEYOR_BUILD_NUMBER% > build_number.h"
- qmake QOwnNotes.pro -r -spec win32-g++
#  - qmake QOwnNotes.pro -r -spec win32-g++ "CONFIG+=debug"
- mingw32-make
# creating the release path
- md ..\%RELEASE_PATH%
# copy the binary to our release path
- copy release\QOwnNotes.exe ..\%RELEASE_PATH%
# copy OpenSSL DLLs to the release path
- copy ..\appveyor\OpenSSL\libeay32.dll ..\%RELEASE_PATH%
- copy ..\appveyor\OpenSSL\libssl32.dll ..\%RELEASE_PATH%
- copy ..\appveyor\OpenSSL\ssleay32.dll ..\%RELEASE_PATH%
# copy portable mode launcher to the release path
- copy ..\appveyor\QOwnNotesPortable.bat ..\%RELEASE_PATH%
# copy translation files
- copy languages\*.qm ..\%RELEASE_PATH%
- cd ..\%RELEASE_PATH%
# fetching dependencies of QT app
# http://doc.qt.io/qt-5/windows-deployment.html
- windeployqt --release QOwnNotes.exe
# this dll was missed by windeployqt
- copy ..\libwinpthread-1.dll . /y
# this dll didn't work when released by windeployqt
- copy "..\libstdc++-6.dll" . /y
# for some reason AppVeyor or windeployqt uses a copy of the German
# translation file as English one, which screws up the English user interface
- del "translations\qt_en.qm"

artifacts:
# pushing entire folder as a zip archive
- path: appveyor\release
    name: QOwnNotes

deploy:
# Deploy to GitHub Releases
- provider: GitHub
    artifact: QOwnNotes
    draft: false
    prerelease: false
    auth_token:
    secure: spcyN/Dz3B2GXBPii8IywDLq6vfxC1SrN+xR2wMerFM7g2nTy0Lrh5agQONFoInR
    on:
    branch: master

notifications:
# Gitter webhook
- provider: Webhook
    url: https://webhooks.gitter.im/e/b6ef22402eb4af50f73a
    on_build_success: true
    on_build_failure: true
    on_build_status_changed: false

I hope that helps a little...

  • Can you please tell how to execute the above yml in windows? I'm not able to get QOwnNotes latest win distro to run on Win 10. – Nikhil VJ Mar 11 '20 at 10:51
  • The `appveyor.yml` was not meant to be "run" on Windows. It is interpreted by AppVeyor on https://ci.appveyor.com/project/pbek/qownnotes/history to build QOwnNotes, but you can see what I do. – Patrizio Bekerle Mar 11 '20 at 15:15
  • > I'm not able to get QOwnNotes latest win distro to run on Win 10 What are you trying to achieve, @NikhilVJ? Maybe post an issue on https://github.com/pbek/QOwnNotes/issues/. – Patrizio Bekerle Mar 11 '20 at 15:16
  • Sorry, I've posted the issue. Got it working with the previous build. – Nikhil VJ Mar 12 '20 at 06:16