windeployqt.exe not working ? Application does not start - qt

I have a simple application using
QT += core gui network webkitwidgets
I've used windeployqt.exe to generate the 32 bits release on my win-10 64 bit computer. When I put the folder on a win-7 64 Bit desktop and double-click the app.exe, it never starts.
I can see it in the task manager, but I can't kill it, and if I try I cannot close the explorer folder in which I double clicked anymore.
I've checked the usual platform, ICU, qwindows.dll, and so on.
http://doc.qt.io/qt-5/windows-deployment.html
EDIT Precisions:
I've compiled with default 32 Bit kit: "build-Test-Desktop_Qt_5_5_1_MinGW_32bit-Release" with "mingw492_32"
I have a package "release" generated by windeployqt.exe using the --webkit switch. I start a command prompt:
> set path=
> set mingw=
Then I make sure that no Qt/Mingw things exists anymore in my environment variables.
I also rename "c:\Qt" into "c:\ __Qt".
I move my release folder on my desktop.
I start release\test.exe ( from the clean path shell )
Everything runs fine! So The release/test.exe has everything it needs without the path/mingw variable.
But as soon as I put the folder on another windows machine ( 7 instead of 10 ) it never starts.
I tried dependency walker. It shows a lot of "API-MS-WIN*.dll" missing...
It even shows much more missing dlls on the "good" machine than on the bad one !!!
Every single "missing dll" on the "bad" target machine is actually in system32 on this machine.
Thanks for advice, every advice is welcome, I'm a bit desperate... :)
Edit
It seems to be related to the machine itself. I have successfully deployed this (very small) app to 2 non developer machine on win7 and win8 respectively. But the above "bad machine" still resits running it...
Edit
The problem seems not to be general but related to this one particular machine. Hence, feel free to close or move to the appropriate forum as it is not related to Qt/windeplyqt. If I figure out a solution, and question is closed, I'll simply add a last edit. Safe Boot and malwarebyte are my next actions.

After a long investigation.
Do not believe dependency walker, it used to be a top notch tool but it is now outdated.
If there is a missing dll, the system will prompt you with "cannot load dll xxx.dll" anyway.
Your best shot in case a soft runs on machine X but not on Machine Y is:
start in safe mode ( run: msconfig --> diagnostic startup )
turn off any antivirus or non microsoft/driver software,
"run as administrator".
If you can run with step 3. Then proceed by elimination:
run without admin rights,
Start anti spyware, etc...
Add appropriate exception to your antivirus if it is the root cause.
If the antivirus is not the root cause, run process monitor on both machines. Then compare, what Failed on one machine and not the other ? Read the windows event log and compare any error messages on both machines.
run sfc /scannow to check disk
run a complete anti spyware scan/ pc-repair tool ( malwarebytes, combofix, ... )
Make sure you really have the very same package on both machines, make sure you are not trying to run an exe on mac OS, make sure your computer is on.
Call the oracle, you are in the matrix...
In my case the problem was Avast and it was solved by adding appropriate exception.

Related

JWrapper windows shortcuts broken

JWrapper support now redirects to StackOverflow, so I'm posting here.
The Windows shortcuts created by JWrapper don't work; they point to a location which doesn't exist; I can verify this by navigating to the directory pointed to in the properties of the shortcut:
C:\Users\jchrist\AppData\Roaming\JWrapper-SampleApp
and seeing that the expected SampleAppWinLauncher.exe isn't there.
I can reproduce this simply with a slight modification of the SampleApp. Open the jwrapper-sampleapp.xml file and copy main virtual app, but give it a different name:
<App>
<Name>SampleApp2</Name>
<LogoPNG>sampleapp/logo.png</LogoPNG>
<MainClass>jwrapper.SampleApp</MainClass>
<Param>one</Param>
<Param>two</Param>
</App>
If you do this, and then run the 32-bit offline installer, you'll get a dialog which allows you to select which of the two virtual apps you want to launch.
After selecting one of the (identical) virtual apps and quiting it, the shortcuts provided in the start menu in the SampleApp folder do not work. If you dig into the properties of the shortcuts, you can see they point to an executable which doesn't exist. (It did exist, but it deletes itself after the first run).
I'm using the latest JWrapper (jwrapper-00036138363.jar, although this problem existed with jwrapper-00035090611.jar) as well.
I've tested this on Windows 7 today and it works OK. I haven't tested this on server 2008 but Windows 7 is treated basically the same as Server 2008 by JWrapper. Also the executable disappearing after the first run is not normal behaviour.
My guess would be that this is antivirus software that is detecting the run as a false positive and deleting the executable. Do you have any AV software installed? can you turn it off to test?
Unfortunately some AV software will delete files etc without any warning.

Qt program does not run and exits immediately when run on another computer

I want to deploy my QT program and I can't find the reason it doesn't work, maybe you guys can help me ?
I work with visual studio 2010, windows 7, QT 5.0.2.
I have tested my deployment tree on my own computer and it works fine.
When deploying my application I ship every necessary dll that I am aware of. Depends.exe does not complain. I also deployed the plugin I know of, and since it still did not work I moved my entire plugin folder in the exe folder.
When I execute it on any other computer than my development computer, the program exits instantaneously with no message whatsoever.
Any idea where I should look now ?
How can I debug that kind of issue ?
Did you try deploying the debug version of the program and then starting it from the command line. The debug version will output more information to the console which could help you resolve the issue.
You will have to also deploy the debug versions of the MS c-runtime libraries.
Deploying the debug version is not a permanent solution, so you should not adopt that as normal routine for distributing your software. I am just suggesting that you try running the debug version one time on that particular machine until you figure out the issue. Then remove the installed program and install the release version again.
You can run your application using QtCreator:
Debug > Start Debugging > Start and Debug External Application...
This can give you more information about what's going on.

compiling samba-shared code fails in qt

I spent the last 2 days trying to make qt on windows 7 compile a samba-shared project hosted on a linux machine (which is visible on win7 as volume Z).
The problem is that after the first modification of any of the source file, the compilation simply does nothing. I mean literally, no errors, no warning. You click "rebuild", and you instantly get the green bar as if everything was recompiled (and it is a large project so it would take a while), but nothing is actually done. All I see in the compilation output is "Running Jom.exe on path" and (1 ms later) "Jom.exe returned normally"
At first I tought samba shared files were somehow changed in attributes or the like, so I checked and indeed they change to +x on the linux box, but even after resetting the original permissions the compiler silently refuses to compile. Actually it is not even invoked at all.
If I duplicate such "modified - not working" tree on the win7 machine, I have the same behaviuor, while if I duplicate the tree from the linux box straight from the beginning, qt works as expected.
I dont think its a qt issue, but I really have no clue on how to fix this, I cant even try NFS since win7 is Pro and has no additional NFS support.
Of course clearing the project an re-running qmake doesnt change anything.
Just for completeness, note that if I make some change to a source file from windows the file is indeed changed in the linux box, its just the compiler that seems not to be invoked anymore

QProcess::startDetached blocked by UAC (running an updater)

I have an update function in my app - it downloads and verifies the installer (a setup.exe, created with NSIS). To actually kick off the update, I have simply been doing:
QString path = .. absolute path to the downloaded file ...
QProcess::startDetached(path, QStringList());
This works fine on XP - but on Vista and Win7, nothing happens once the download completes. If I browse to the downloaded update and run it manually, it works fine. I assume what's happening is that UAC is blocking the installer at CreateProcess time, but this is where my knowledge runs out.
Additional complication - when I'm running a debug build from the command line, the steps above work - I get the UAC prompt and can run the installer. It's the release builds, started form the start menu/shortcut, which have the issue - I assume there's a difference in the auth token when running from a command shell.
You can also use
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
Might be surprising and counterintuitive, but it works and is more cross-platform
If you are not admin and you call CreateProcess() on a .exe with a "Vista" manifest (or no manifest, but a .exe that windows detects as an installer (This includes NSIS)) the call fails, you need to use ShellExecute[Ex](). ShellExecute will trigger UAC prompt if required...
This seems to be a Qt bug, see QTBUG-9761 , the correct workaround is to use ShellExecute with lpOperation set to runas.
Another alternative is to prepend your execution with cmd.exe /C. This effectively routes your execution through the shell, so you do get the UAC prompt. The downside is that if your process fails you probably won't get as much information had you gone through ShellExecute[Ex], but on the plus side you will get all the facilities of QProcess that you miss if you use QDesktopServices::openUrl, where you have no idea if things worked or not.

Why don't QLocalSocket/Server connections work when one process was invoked by an NSIS installer?

I have an NSIS installer that installs my Qt application. At the end of the install process, the installer gives the user the option to launch the application immediately.
My application uses QLocalSocket/QLocalServer to talk to other local instances of the application. (They talk to each other basically just to ensure that there's only one instance of the app running at a time.) However, on Vista, if one of the instances was started up by the installer, then other instances cannot talk to that instance unless they were also started by the installer (or uninstaller, interestingly).
The NSIS installer launches the app with the Exec command. The client tries to connect to the server through QLocalSocket::connectToServer, which fails with the error "QLocalSocket::connectToServer: Unknown error 5".
Can anyone explain this? What's the best way to work around it?
If 5 is a windows error code, it would mean access denied. Is there a way for you to change the security on this server (You would need to access the native pipe handle)?
The finish page run option has more issues than just this, the new process gets the wrong HKCU and user profile etc.
I would recommend just disabling the run checkbox on the finish page. (This issue goes all the way back to win2000 when RunAs was added)
If you really really want this run checkbox, you can use the UAC plugin, it will allow you to start a child process as the "correct" user.
Finally figured this out. The installer was running as admin (the install script said "RequestExecutionLevel admin"), and apparently it launched my app with those elevated permissions, which meant that other instances of my app running with user-level permissions couldn't connect to it. QLocalSocket/Server uses named pipes on windows, so I figure this is a windows security feature. I'm planning to work around this by using the UAC NSIS plugin, which I believe lets you run a process with user-level permissions.

Resources