Deploying to a thumb drive in Windows



  • I'm trying to get things set up so that my program can be run off of a thumb drive without installing anything. I have compiled the release executable using Qt Creator and the MSVC15 toolchain. Then I copied that exe to the thumb drive and ran windeployqt.exe with the executable as an argument. It appears to run fine and copies in the required DLLs. But when I try to run the program, I get a message:

    The procedure entry point
    ?convertVolume@QAudio@@YANNW4VolumeScale@1@0@Z could not be located in the dynamic link library [path to my .exe here]
    

    Any ideas for what has gone wrong, or how to debug it?



  • Hi, a guess but since QAudio::convertVolume() is new for the Qt 5.8 release, if you have also some older version of Qt installed, perhaps windeployqt copied the Qt DLLs (specifically qt5multimedia.dll that provides that function) not from Qt 5.8 but from an older version.
    If you look at the qt5multimedia.dll on your thumb drive, is it dated January 18 this year (i.e. 5.8) or?



  • The copy of Qt5Multimedia.dll is dated January 16th, 2017. Is there a Windows equivalent of nm, or some command I can use to interrogate the contents of that dll to verify that it's the right version/contains the symbol?



  • Sure, inside MSCVC15's toolchain there's a dumpbin program. Start a Developer Command Promot and type:
    dumpbin/exports Qt5Multimedia.dll
    to grep that specific entry point:
    dumpbin/exports Qt5Multimedia.dll | find "convertV"



  • OK, it's not in there: the only references to volume are:

           1820  71B 0000D110 ?setVolume@QAbstractAudioOutput@@UEAAXN@Z
           1821  71C 000136D0 ?setVolume@QAudioInput@@QEAAXN@Z
           1822  71D 000136D0 ?setVolume@QAudioOutput@@QEAAXN@Z
           1823  71E 0003C930 ?setVolume@QMediaPlayer@@QEAAXH@Z
           1824  71F 0004D350 ?setVolume@QMediaRecorder@@QEAAXN@Z
           1825  720 000483B0 ?setVolume@QRadioTuner@@QEAAXH@Z
           1826  721 000162F0 ?setVolume@QSoundEffect@@QEAAXN@Z
           2207  89E 00015870 ?volume@QAbstractAudioOutput@@UEBANXZ
           2208  89F 00013790 ?volume@QAudioInput@@QEBANXZ
           2209  8A0 00013790 ?volume@QAudioOutput@@QEBANXZ
           2210  8A1 00047F70 ?volume@QMediaPlayer@@QEBAHXZ
           2211  8A2 0004DC20 ?volume@QMediaRecorder@@QEBANXZ
           2212  8A3 000485A0 ?volume@QRadioTuner@@QEBAHXZ
           2213  8A4 000164E0 ?volume@QSoundEffect@@QEBANXZ
           2214  8A5 0003CBA0 ?volumeChanged@QMediaPlayer@@QEAAXH@Z
           2215  8A6 000303B0 ?volumeChanged@QMediaPlayerControl@@QEAAXH@Z
           2216  8A7 0004DC40 ?volumeChanged@QMediaRecorder@@QEAAXN@Z
           2217  8A8 00031540 ?volumeChanged@QMediaRecorderControl@@QEAAXN@Z
           2218  8A9 000485C0 ?volumeChanged@QRadioTuner@@QEAAXH@Z
           2219  8AA 00033390 ?volumeChanged@QRadioTunerControl@@QEAAXH@Z
           2220  8AB 000164F0 ?volumeChanged@QSoundEffect@@QEAAXXZ
    

    So this looks to me like that DLL is actually a previous version (5.7 maybe?). Is there something I can do to actually check the Qt version it's from?



  • OK, turns out that a simple "Properties" on the dll tells me it's actually 5.6.2. In fact, I think that all of the dlls are 5.6.2. I very specifically used C:\Qt\5.8\MSVC2015_64\bin\windeployqt.exe, so how did I wind up with the 5.6 libraries?



  • Hmm, windeployqt has a habit of picking up Qt DLLs from your PATH settings, so perhaps even if you explicitly invoked the 5.8 version it picked up 5.6.2 stuff located in the PATH.
    You could try first to cd to C:\Qt\5.8\msvc2015_64\bin and then run windeployqt <path to your .exe>



  • Yep, doing that got it to copy the correct DLLs. Thanks!

    Getting closer, now. It runs great off the thumb drive on my development machine. But when I try to run on a non-Dev machine it fails with the “could not find or load the Qt platform plugin” error. I tried to match up what I was seeing with your blog post at http://www.tripleboot.org/?p=138 (copying what I think are the appropriate msvcr120 and msvcp120 dlls), but no luck. The error says that "windows" is an available platform, but it's not loading.

    Based on that blog post, and my use of windeployqt, it seemed to me that what I needed to do was to:

    • Compile the release version
    • Run windeployqt on that exe to copy all the needed Qt DLLs
    • Manually copy in msvcr120.dll and msvcp120.dll from the dev machine's C:\Windows\system32 folder

    Then, if I move the thumb drive to another machine, the drive will contain all of the necessary files and should launch. Clearly I have missed something!



  • For the record, using the vcredist_x64.exe installer on the machine I'm testing did not resolve the issue, so it would seem that it's not an issue with those DLLs.



  • Hi, sorry my bad! (being lazy, have not updated the blog for MSVC2015)
    The relevant DLLs for VC15 are:

    vcruntime140.dll
    msvcp140.dll
    ucrtbase.dll

    (they skipped over xxx13 versions, bad luck?) And as you say, copy them from C:\Windows\System32 because you want 64-bit flavor, and not from C:\Windows\SysWOW64, where the 32-bit versions are.

    Edit: if you still get "windows" platform errors, there are plenty of (still valid) advice on the blog :-)



  • Brilliant! I blew away my old release directory, recompiled from scratch, was careful to run the deploy tool from the 5.8 directory, and copied those three DLLs, and I'm in business, it runs! Thanks a ton for your assistance, both here and in your blog posts.


Log in to reply
 

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