Unsolved Segmentation fault before main() on different host
-
Hi there,
I am trying to install a Qt application I wrote myself on a PC in our company. It runs fine on my development machine, even when I don't have anything related to Qt in my PATH variable. On the destination machine, it exits with a segmentation fault before executing main().
Here are the specs:
Development machine:
OS Name: Microsoft Windows 10 Pro
Version: 10.0.17763 Build 17763
System Type: x64-based PC
Processor: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz, 2807 Mhz, 4 Core(s), 4 Logical Processor(s)Qt Version: 5.5.0 mingw492_32
Compiler: MinGW 4.9.2 32bitDestination machine:
OS Name: Microsoft Windows 7 Professional
Version: 6.1.7601 Service Pack 1 Build 7601
Systemtype: x64-basierter PC
Processor: Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz, 2001 MHz, 4 Core(s), 8 Logical Processor(s)I use windeployqt to deploy most of the dependencies. Since the app uses the PSQL plugin, I copied the PosgreSQL client libraries from my PostgreSQL 9.6 installation next to the executable. As I said, this works just fine on my development machine and all the other PCs where this app is installed. Only this specific one causes trouble.
Here is what strace under Cygwin prints:
--- Process 724 created
--- Process 724 loaded C:\Windows\System32\ntdll.dll at 0000000077b70000
--- Process 724 loaded C:\Windows\SysWOW64\ntdll.dll at 0000000077d30000
--- Process 724 loaded C:\Windows\System32\wow64.dll at 00000000744e0000
--- Process 724 loaded C:\Windows\System32\wow64win.dll at 0000000074480000
--- Process 724 loaded C:\Windows\System32\wow64cpu.dll at 0000000074470000
--- Process 724 loaded C:\Windows\System32\kernel32.dll at 0000000077a50000
--- Process 724 unloaded DLL at 0000000077a50000
--- Process 724 loaded C:\Windows\SysWOW64\kernel32.dll at 0000000075750000
--- Process 724 unloaded DLL at 0000000075750000
--- Process 724 loaded C:\Windows\System32\kernel32.dll at 0000000077a50000
--- Process 724 unloaded DLL at 0000000077a50000
--- Process 724 loaded C:\Windows\System32\user32.dll at 0000000077950000
--- Process 724 unloaded DLL at 0000000077950000
--- Process 724 loaded C:\Windows\SysWOW64\kernel32.dll at 0000000075750000
--- Process 724 loaded C:\Windows\SysWOW64\KernelBase.dll at 0000000075640000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5Cored.dll at 000000006b780000
--- Process 724 loaded C:\Windows\SysWOW64\advapi32.dll at 00000000756a0000
--- Process 724 loaded C:\Windows\SysWOW64\msvcrt.dll at 0000000075590000
--- Process 724 loaded C:\Windows\SysWOW64\sechost.dll at 0000000077710000
--- Process 724 loaded C:\Windows\SysWOW64\rpcrt4.dll at 0000000076020000
--- Process 724 loaded C:\Windows\SysWOW64\sspicli.dll at 0000000075450000
--- Process 724 loaded C:\Windows\SysWOW64\cryptbase.dll at 0000000075440000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\libgcc_s_dw2-1.dll at 0000000000320000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\libwinpthread-1.dll at 0000000064940000
--- Process 724 loaded C:\Windows\SysWOW64\mpr.dll at 0000000073ce0000
--- Process 724 loaded C:\Windows\SysWOW64\ole32.dll at 0000000076300000
--- Process 724 loaded C:\Windows\SysWOW64\gdi32.dll at 0000000076110000
--- Process 724 loaded C:\Windows\SysWOW64\user32.dll at 0000000075a10000
--- Process 724 loaded C:\Windows\SysWOW64\lpk.dll at 00000000776d0000
--- Process 724 loaded C:\Windows\SysWOW64\usp10.dll at 0000000075860000
--- Process 724 loaded C:\Windows\SysWOW64\shell32.dll at 0000000076460000
--- Process 724 loaded C:\Windows\SysWOW64\shlwapi.dll at 0000000077100000
--- Process 724 loaded C:\Windows\SysWOW64\ws2_32.dll at 00000000770c0000
--- Process 724 loaded C:\Windows\SysWOW64\nsi.dll at 0000000075690000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\libstdc++-6.dll at 0000000001110000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5Declaratived.dll at 00000000014b0000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5Guid.dll at 00000000072f0000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5Networkd.dll at 0000000067c80000
--- Process 724 loaded C:\Windows\SysWOW64\crypt32.dll at 00000000775a0000
--- Process 724 loaded C:\Windows\SysWOW64\msasn1.dll at 00000000754b0000
--- Process 724 loaded C:\Windows\SysWOW64\dnsapi.dll at 00000000741f0000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5Sqld.dll at 0000000011070000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5Widgetsd.dll at 0000000011620000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5Scriptd.dll at 000000001add0000
--- Process 724 loaded C:\Windows\SysWOW64\winmm.dll at 0000000073ca0000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\Qt5XmlPatternsd.dll at 0000000020710000
--- Process 724, exception 4000001f at 0000000077dd0f74
--- Process 724 loaded C:\Windows\SysWOW64\imm32.dll at 00000000778f0000
--- Process 724 loaded C:\Windows\SysWOW64\msctf.dll at 00000000754c0000
--- Process 724 loaded C:\Windows\SysWOW64\shell32.dll at 000000002b710000
--- Process 724 unloaded DLL at 000000002b710000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\platforms\qwindowsd.dll at 0000000062840000
--- Process 724 loaded C:\Windows\SysWOW64\oleaut32.dll at 00000000761d0000
--- Process 724 loaded C:\Windows\SysWOW64\uxtheme.dll at 0000000071890000
--- Process 724 loaded C:\Windows\SysWOW64\user32.dll at 000000002b2e0000
--- Process 724 unloaded DLL at 000000002b2e0000
--- Process 724 loaded C:\Windows\SysWOW64\shell32.dll at 000000002b710000
--- Process 724 unloaded DLL at 000000002b710000
--- Process 724 loaded C:\Windows\SysWOW64\dwmapi.dll at 0000000074550000
--- Process 724 loaded C:\Windows\SysWOW64\shell32.dll at 000000002b710000
--- Process 724 unloaded DLL at 000000002b710000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\sqldrivers\qsqlpsqld.dll at 000000002b920000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\libpq.dll at 0000000029b70000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\ssleay32.dll at 000000002ba20000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\libeay32.dll at 000000002ba70000
--- Process 724 loaded C:\Windows\SysWOW64\msvcr100.dll at 000000002bb90000
--- Process 724 loaded C:\Program Files (x86)\MyCompany\MyApp\libintl.dll at 000000006a300000
--- Process 724 loaded C:\Windows\SysWOW64\wsock32.dll at 00000000003e0000
--- Process 724 loaded C:\Windows\SysWOW64\secur32.dll at 0000000074000000
--- Process 724 loaded C:\Windows\SysWOW64\Wldap32.dll at 0000000075900000
--- Process 724 loaded C:\Windows\SysWOW64\version.dll at 0000000073d40000
--- Process 724 unloaded DLL at 0000000073d40000
--- Process 724 loaded C:\Windows\SysWOW64\mswsock.dll at 0000000074260000
--- Process 724 loaded C:\Windows\SysWOW64\version.dll at 0000000073d40000
--- Process 724 unloaded DLL at 0000000073d40000
--- Process 724 loaded C:\Windows\SysWOW64\WSHTCPIP.DLL at 0000000074250000
--- Process 724 loaded C:\Windows\SysWOW64\wship6.dll at 0000000074240000
--- Process 724 loaded C:\Program Files (x86)\Bonjour\mdnsNSP.dll at 0000000071e40000
--- Process 724 loaded C:\Windows\SysWOW64\IPHLPAPI.DLL at 00000000743a0000
--- Process 724 loaded C:\Windows\SysWOW64\winnsi.dll at 0000000074390000
--- Process 724 thread 4396 created
--- Process 724 loaded C:\Windows\SysWOW64\rasadhlp.dll at 0000000071e30000
--- Process 724 loaded C:\Windows\SysWOW64\FWPUCLNT.DLL at 0000000071df0000
--- Process 724 thread 4560 created
--- Process 724, exception c0000005 at 0000000000422d1c
--- Process 724 thread 4396 exited with status 0xc0000005
--- Process 724 thread 4560 exited with status 0xc0000005
--- Process 724 exited with status 0xc0000005
Segmentation faultI tried a debug build as well. This is why you see the Qt debug libraries in the strace output.
Are there any other methods to debug this problem? Or do you guys even have a solution I could try? I would be really grateful! Please tell me if you need more information.
Thanks
Tobi -
Have you tried depends? Should check to see what dll dependencies you are missing if there are any. It also says when you have 32 bit (or 64 bit) libraries when you need the opposite one. I have been able to resolve several similar deployment issues with that tool. It is at least a good place to start.
-
I've also found that trying to execute the application from the command line in windows will put up and error message indicating which DLL is missing.
-
What you describe almost universally means you have globals that were depending on a specific order of initialization. The host change sometimes translates to initialization order change, thus you segfault in the static init routines that the loader executes.
-
@kshegunov said in Segmentation fault before main() on different host:
initialization order change,
Just ran into this the other day. Objects defined in a global context had constructors that got run before main. On Linux it worked in an order that didn't cause problems. On Windows it ran in a destructive order. I have been looking at the code more closely to what other hidden behavior it has. There is way TOO much global stuff going on in this code.