You are not logged in.

#1 2016-09-29 07:11:05

nemo19
Member
Registered: 2016-09-29
Posts: 2

[Solved] Qt app running fine on Ubuntu segfaults immediately

Hey guys,

I've got a problem running a Qt application and getting somewhat desperate. I'm part of the software engineering team developing the program and need to run and test it. I was able to do so up to now using Ubuntu, but not using Arch.

When I got my PC it was running a fresh install of Ubuntu 16.04LTS x64. I installed qt-sdk, vtk and some other required libraries. Worked on the program, compiled it, ran it. All worked fine.

Then I replaced Ubuntu by a fresh Arch install (which is what I'm using at home), installed qt5-*, vtk and the other libraries. Compiled the program, started it, and it immediately said

 Segmentation fault (core dumped) 

Running in gdb gives

Program received signal SIGSEGV, Segmentation fault.
0x00007fffee46bb74 in ?? () from /usr/lib/libQtGui.so.4
(gdb) bt
#0  0x00007fffee46bb74 in ?? () from /usr/lib/libQtGui.so.4
#1  0x00007ffff7de94fa in call_init.part () from /lib64/ld-linux-x86-64.so.2
#2  0x00007ffff7de960b in _dl_init () from /lib64/ld-linux-x86-64.so.2
#3  0x00007ffff7ddadaa in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#4  0x0000000000000001 in ?? ()
#5  0x00007fffffffe455 in ?? ()
#6  0x0000000000000000 in ?? ()

I added the qt-debug repo to pacman, replaced qt5-* by qt5-*-debug, set CONFIG += debug in the PRO file and all the g++ debug flags, but got the same output.  Then I set a breakpoint at the first line of main(), which is empty. It still segfaults before reaching the breakpoint. Running in QtCreator Debug mode pops up the message

The inferior stopped because it received a signal from the operating system.

Signal name :  SIGSEGV
Signal meaning :  Segmentation fault

and prints out a bunch of assembler code

0x7fffee581b60                   b4 00                 mov    $0x0,%ah
0x7fffee581b62                   00 00                 add    %al,(%rax)
0x7fffee581b64                   00 00                 add    %al,(%rax)
0x7fffee581b66                   c6 05 a3 6f b4 00 00  movb   $0x0,0xb46fa3(%rip)        # 0x7fffef0c8b10
0x7fffee581b6d                   48 89 05 a4 6f b4 00  mov    %rax,0xb46fa4(%rip)        # 0x7fffef0c8b18
0x7fffee581b74                   f0 ff 00              lock incl (%rax)
0x7fffee581b77                   0f 95 c2              setne  %dl
0x7fffee581b7a                   f0 ff 0f              lock decl (%rdi)
0x7fffee581b7d                   0f 95 c0              setne  %al
0x7fffee581b80                   84 c0                 test   %al,%al
0x7fffee581b82                   74 1e                 je     0x7fffee581ba2
0x7fffee581b84                   48 8d 15 f5 19 b4 00  lea    0xb419f5(%rip),%rdx        # 0x7fffef0c3580
0x7fffee581b8b                   48 8d 35 6e 6f b4 00  lea    0xb46f6e(%rip),%rsi        # 0x7fffef0c8b00
0x7fffee581b92                   48 8d 3d c7 d5 1a 00  lea    0x1ad5c7(%rip),%rdi        # 0x7fffee72f160
0x7fffee581b99                   48 83 c4 08           add    $0x8,%rsp
0x7fffee581b9d                   e9 5e 5d ff ff        jmpq   0x7fffee577900 <__cxa_atexit@plt>
0x7fffee581ba2                   e8 69 b4 ff ff        callq  0x7fffee57d010 <_ZN7QString4freeEPNS_4DataE@plt>
0x7fffee581ba7                   eb db                 jmp    0x7fffee581b84
0x7fffee581ba9                   0f 1f 80 00 00 00 00  nopl   0x0(%rax)
0x7fffee581bb0                   48 83 ec 08           sub    $0x8,%rsp
0x7fffee581bb4                   8b 05 92 6f b4 00     mov    0xb46f92(%rip),%eax        # 0x7fffef0c8b4c
0x7fffee581bba                   85 c0                 test   %eax,%eax
0x7fffee581bbc                   75 16                 jne    0x7fffee581bd4
0x7fffee581bbe                   48 8d 3d d9 30 6d 00  lea    0x6d30d9(%rip),%rdi        # 0x7fffeec54c9e
0x7fffee581bc5                   48 83 ce ff           or     $0xffffffffffffffff,%rsi
0x7fffee581bc9                   e8 d2 b4 1d 00        callq  0x7fffee75d0a0
0x7fffee581bce                   89 05 78 6f b4 00     mov    %eax,0xb46f78(%rip)        # 0x7fffef0c8b4c
0x7fffee581bd4                   48 8d 3d c3 30 6d 00  lea    0x6d30c3(%rip),%rdi        # 0x7fffeec54c9e

Please let me know if you have any ideas as to why the same program compiles fine on both Ubuntu and Arch, but runs only on Ubuntu, and how I can get the debugging symbols to show up.

Google returned only very few results which did not help at all.

Last edited by nemo19 (2016-09-29 10:31:17)

Offline

#2 2016-09-29 09:41:20

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [Solved] Qt app running fine on Ubuntu segfaults immediately

# pacman -Fyo /usr/lib/libQtGui.so.4
:: Synchronizing package databases...
 core                                                  655.0 KiB  7.35M/s 00:00 [#############################################] 100%
 extra                                                   7.3 MiB  6.20M/s 00:01 [#############################################] 100%
 community                                              14.3 MiB  5.69M/s 00:03 [#############################################] 100%
 multilib                                              298.7 KiB  5.12M/s 00:00 [#############################################] 100%
 llvm-svn                                                7.6 KiB  0.00B/s 00:00 [#############################################] 100%
 LoneVVolf is up to date
usr/lib/libQtGui.so.4 is owned by extra/qt4 4.8.7-9
# 

On Arch Linux libQtGui.so*  is used exclusively for Qt4 , Qt5 uses libQt5Gui.so* .

Maybe ubuntu uses a different mechanism to distinguish between Qt4 & Qt5 .

Last edited by Lone_Wolf (2016-09-29 09:42:02)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2016-09-29 10:29:46

nemo19
Member
Registered: 2016-09-29
Posts: 2

Re: [Solved] Qt app running fine on Ubuntu segfaults immediately

Thank you, that helped a lot.

I had just figured out that the segfault was caused by including a matching header/source file pair in the build. When excluding it everything worked fine. Thanks to you I checked with ldd which revealed, that when building without the files only libQt5Gui.so.5 is used, but when including them libQt5Gui.so.5 AND libQtGui.so.4 are used.

So far I have no idea how that is possible or why that happens (and why not on Ubuntu), but at least I know where to look.

Offline

Board footer

Powered by FluxBB