Home > Enterprise >  Windows 11/MinGW 64-Bit: QT-Application not starting from "C:/Program Files" but from anyw
Windows 11/MinGW 64-Bit: QT-Application not starting from "C:/Program Files" but from anyw

Time:12-29

I've ported a Qt 5.12.12 application from Linux to Windows 11 using the Toolchain coming together with the Qt-Installer: QtCreator, MinGW 7.30, amd64, C . So far, everything works out fine except when I deploy the app (via a Inno Setup Studio Installer, all the used *.dll files included) to "Program Files".

When the program (named "orange") resides in C:/Program Files/ORANGE/orange.exe it will never start, except when "run as administrator". When I rename the exact folder C:/Program Files/ORANGE to C:/ORANGE, then everything works fine without "admin privileges"; the app runs flawlessly. Same on any folder on D:/ drive.

When starting from C:/Program Files/ORANGE/orange.exe the program fails silently, but in the Windows event log I can see an entry like that in "Computer Management->System Tools->Event Viewer->Custom Views->Administrative Events":

Faulting application name: orange.exe, version: 1.1.0.0, time stamp: 0x61ca2b05
Faulting module name: libgcc_s_seh-1.dll, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0x40000015
Fault offset: 0x000000000000d125
Faulting process id: 0x5b90
Faulting application start time: 0x01d7fb68b04bbb8e
Faulting application path: C:\Program Files\ORANGE\orange.exe
Faulting module path: C:\Program Files\ORANGE\libgcc_s_seh-1.dll
Report Id: 3ccd12e6-cfd5-4cff-8d1b-c5450716a821
Faulting package full name: 
Faulting package-relative application ID: 

I'm not usually a Windows-Developer so any help on howto further debug or resolve this is highly appreciated.

CodePudding user response:

It turns out that @drescherjm got it right: My app did try to write logfiles to its own working directory (which was fine on my prior Linux setup). Moving the log-location to %appdata% (i.e. QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)) did resolve the issue.

...as I'm using boost::log I was mislead by the reference to libgcc_s_seh-1.dll in the error log. Reminds me of improving/reviewing log clarity ;)

Thank you all for your help!

CodePudding user response:

Hi the best way to find out if this is a permission error or a dependency problem (or both :) is to download the dependency walker https://www.dependencywalker.com/ and run it on the .exe file. In your case it seems that it is looking for a library (.dll) in your local folder instead of the runtime folder (which probably can only be accessed by administrator)

The solution would be either

Change the libraries folder permissions as suggested in above comments

Change the privileges of your normal user to a power user (local admin with explicit access to admin folders)

Add the path of the referenced library to the PATH in Systems Environment Variables

  • Related