[SOLVED] Failed to load platform plugin.



  • I have compiled Qt5 libraries for Windows using MinGW. Programs compiled with that version doesn't run on 64 bit Windows. AFAIK it should be possible to run a 32bit application on 64bit machine. The error seems something related to msvcrt.dll :

    !http://s1.picofile.com/file/7607928167/x86_qt5_error.png(test)!

    For 64-bit versions, there is no problem. This is the simple "test GUI test":http://s3.picofile.com/file/7607874836/Q.7z.html program containing all DLLs needed to run (including msvcrt.dll)


  • Moderators

    You can run 32 bit applications on 64 bit windows. I am running minGW compiled 32 bit applications on Windows 7 64 bit.

    Did you check the required dlls with the dependency walker already?



  • [quote author="koahnig" date="1357293503"]
    Did you check the required dlls with the dependency walker already? [/quote]

    Yes. Everything looks sane to me. I double-echecked PATH, architectures of binaries, and everything else. Can't find the problem...

    Program exits with following error message:
    @
    Failed to load platform plugin "windows". Available platforms are:

    Invalid parameter passed to C runtime function.
    Invalid parameter passed to C runtime function.
    @



  • Did you deploy platform/qwindows.dll as well? (It will not show up in Dependency Walker).



  • [quote author="Lukas Geyer" date="1357298812"]Did you deploy platform/qwindows.dll as well? (It will not show up in Dependency Walker).[/quote]

    No I didn't know about that. It's not present in installation directory. It's in qtbase/plugin/platform. Though adding that file, program does not run yet.

    I made a 7z archive of all DLL s that Dependency Walker can see + msvcrt . It just don't run on any 64bit windows machine. I had no chance to test with 32 yet



  • It is actually platform s /qwindows.dll, not platform/qwindows.dll. Be aware that you will have to deploy platforms/qwindows d .dll if you are deploying a debug build.

    With these changes, do you still get <code>Failed to load platform plugin "windows". Available platforms are:</code>?



  • [quote author="Lukas Geyer" date="1357301238"]It is actually platform s /qwindows.dll, not platform/qwindows.dll.[/quote]

    Yea, my typo

    [quote author="Lukas Geyer" date="1357301238"]Be aware that you will have to deploy platforms/qwindows d .dll if you are deploying a debug build.

    With these changes, do you still get <code>Failed to load platform plugin "windows". Available platforms are:</code>?[/quote]

    I tried both debug and release builds with libraries with/without debugging symbols. It's still same.



  • Using the <code>-platformpluginpath</code> command line option or the <code>QT_QPA_PLATFORM_PLUGIN_PATH</code> environment variable might be another option, but Qt should pickup the plugin automatically when placed in the correct location.



  • [quote author="Lukas Geyer" date="1357305345"]Using the <code>-platformpluginpath</code> command line option or the <code>QT_QPA_PLATFORM_PLUGIN_PATH</code> environment variable might be another option, but Qt should pickup the plugin automatically when placed in the correct location.[/quote]

    It is there, I copied everything beside the program executable. I believe it's in visible scope for linkage. The problem might be related to msvcrt .


  • Moderators

    qwindows.dll shouldn't be in the same dir as the executable. Put it in the platforms subdirectory.



  • [quote author="Krzysztof Kawa" date="1357310438"]qwindows.dll shouldn't be in the same dir as the executable. Put it in the platforms subdirectory.[/quote]
    Ah my bad memory :P In fact I have had same problem with paths for mysql driver on windows... Now works fine.

    Thank you



  • [quote author="Lukas Geyer" date="1357298812"]Did you deploy platform/qwindows.dll as well? (It will not show up in Dependency Walker).[/quote]

    FWIW: DLL's that are loaded at runtime, like Plug-in DLL's, do show up in Dependency Walker, but only when you use the "profiling" feature. They of course cannot be found by only analyzing the static import tables...



  • Profiling never worked quite well for me (STATUS_STACK_BUFFER_OVERRUN and alike), but good to know. Thanks for sharing.



  • Can you elaborate how this issue was fixed ?
    You created a "platforms" directory inside your project folder and put the qwindows.dll in there ?



  • Looks like you have to create "platforms" directory in folder, were your program runs. For example, I have "debug" folder in my project, and I copied "platforms" directory there from "c:\Qt\Qt5.0.1\5.0.1\mingw47_32\plugins". This solved my problem.

    Also you can copy other plugins if needed.



  • @Chris-Kawa

    Hi. I did as you said and it worked! thanks!
    welmore


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.