AntiMicro / antimicro

[NOT maintained anymore] Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support
1.8k stars 201 forks source link

AntiMicro > 2.20.2 segfaults on Slackware >= 14.1 #26

Closed slacknk closed 8 years ago

slacknk commented 8 years ago

$ antimicro Segmentation fault

Last version that works - 2.20.2. I've tried both 2.21 and git current but I'm getting segmentation fault with the same stacktrace:

└─$ cd /tmp
└─$ rm -rf antimicro
└─$ git clone https://github.com/AntiMicro/antimicro
...
└─$ cd antimicro/
└─$ ls
AntiMicro\ Future\ Developments.mm  Changelog       Resources.txt             other/  windows/
BuildOptions.md                     ProfileTips.md  cmake_uninstall.cmake.in  share/
CMakeLists.txt                      README.md       gpl.txt                   src/

slackware32-14.1 and qt4(-4.8.7):

export CFLAGS="-O0 -g -ggdb"; export CXXFLAGS="-O0 -g -ggdb"; mkdir -p build; cd build; QT_SELECT=4 cmake ../; make

└─$ export CFLAGS="-O0 -g -ggdb"; export CXXFLAGS="-O0 -g -ggdb"; mkdir -p build; cd build; QT_SELECT=4 cmake ../; make
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.25") 
-- checking for module 'sdl2'
--   found sdl2, version 2.0.4
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/libX11.so
XTest support allowed for simulating events.
Compiling with Qt4 support
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: /usr/bin/qmake (found version "4.8.7") 
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/antimicro/build
[  0%] Generating qrc_resources.cxx
[  0%] Generating src/moc_mainwindow.cxx
[  0%] Generating src/moc_joybuttonwidget.cxx
[  0%] Generating src/moc_joystick.cxx
[  1%] Generating src/moc_joybutton.cxx
[  1%] Generating src/joybuttontypes/moc_joygradientbutton.cxx
[  1%] Generating src/moc_inputdaemon.cxx
[  2%] Generating src/moc_joyaxis.cxx

...

[ 30%] Generating src/eventhandlers/moc_xtesteventhandler.cxx
[ 31%] Generating ui_mainwindow.h
[ 31%] Generating ui_axiseditdialog.h
/tmp/antimicro/src/axiseditdialog.ui: Warning: Z-order assignment: '' is not a valid widget.
/tmp/antimicro/src/axiseditdialog.ui: Warning: Z-order assignment: 'verticalSpacer' is not a valid widget.
/tmp/antimicro/src/axiseditdialog.ui: Warning: Z-order assignment: 'verticalSpacer_2' is not a valid widget.
[ 31%] Generating ui_advancebuttondialog.h
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: 'verticalSpacer_5' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: '' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: 'verticalSpacer_6' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: 'verticalSpacer_2' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: '' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: 'verticalSpacer' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: '' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: 'verticalSpacer_4' is not a valid widget.
/tmp/antimicro/src/advancebuttondialog.ui: Warning: Z-order assignment: '' is not a valid widget.
[ 31%] Generating ui_aboutdialog.h
[ 32%] Generating ui_setaxisthrottledialog.h
[ 32%] Generating ui_buttoneditdialog.h
[ 32%] Generating ui_joycontrolstickeditdialog.h
[ 33%] Generating ui_advancestickassignmentdialog.h
[ 33%] Generating ui_dpadeditdialog.h
[ 33%] Generating ui_quicksetdialog.h
[ 33%] Generating ui_mousesettingsdialog.h
[ 34%] Generating ui_joystickstatuswindow.h
[ 34%] Generating ui_qkeydisplaydialog.h
[ 34%] Generating ui_gamecontrollermappingdialog.h
[ 35%] Generating ui_mainsettingsdialog.h
[ 35%] Generating ui_setnamesdialog.h
[ 35%] Generating ui_addeditautoprofiledialog.h
[ 35%] Generating ui_editalldefaultautoprofiledialog.h
[ 36%] Generating ui_extraprofilesettingsdialog.h
[ 36%] Generating ui_capturedwindowinfodialog.h
/tmp/antimicro/src/capturedwindowinfodialog.ui: Warning: Z-order assignment: '' is not a valid widget.
Scanning dependencies of target antimicro
[ 37%] Building CXX object CMakeFiles/antimicro.dir/src/main.cpp.o
[ 37%] Building CXX object CMakeFiles/antimicro.dir/src/mainwindow.cpp.o
[ 37%] Building CXX object CMakeFiles/antimicro.dir/src/joybuttonwidget.cpp.o
[ 37%] Building CXX object CMakeFiles/antimicro.dir/src/joystick.cpp.o
[ 38%] Building CXX object CMakeFiles/antimicro.dir/src/joybutton.cpp.o

...

[ 97%] Building CXX object CMakeFiles/antimicro.dir/src/moc_x11extras.cxx.o
[ 98%] Building CXX object CMakeFiles/antimicro.dir/src/moc_qtx11keymapper.cxx.o
[ 98%] Building CXX object CMakeFiles/antimicro.dir/src/moc_unixcapturewindowutility.cxx.o
[ 98%] Building CXX object CMakeFiles/antimicro.dir/src/moc_autoprofilewatcher.cxx.o
[ 98%] Building CXX object CMakeFiles/antimicro.dir/src/moc_capturedwindowinfodialog.cxx.o
[100%] Building CXX object CMakeFiles/antimicro.dir/src/eventhandlers/moc_xtesteventhandler.cxx.o
[100%] Building CXX object CMakeFiles/antimicro.dir/qrc_resources.cxx.o
Linking CXX executable bin/antimicro
[100%] Built target antimicro
└─$ cd bin/
└─$ ./antimicro 
Segmentation fault

$ gdb ./antimicro

└─$ gdb ./antimicro
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-slackware-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/antimicro/build/bin/antimicro...done.
(gdb) r
Starting program: /tmp/antimicro/build/bin/./antimicro 
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.3600.4-gdb.py", line 9, in <module>
    from gobject import register
  File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
    import gdb.backtrace
ImportError: No module named backtrace

Program received signal SIGSEGV, Segmentation fault.
0x080c8bc6 in QBasicAtomicInt::ref (this=0x0) at /usr/lib/qt/include/QtCore/qatomic_i386.h:120
120                  : "memory");
(gdb) thread apply all backtrace

Thread 1 (Thread 0xb67f4980 (LWP 504)):
#0  0x080c8bc6 in QBasicAtomicInt::ref (this=0x0)
    at /usr/lib/qt/include/QtCore/qatomic_i386.h:120
#1  0x080c8d12 in QString::QString (this=0x82d32d0 <X11Extras::mouseDeviceName>, other=...)
    at /usr/lib/qt/include/QtCore/qstring.h:726
#2  0x0820676c in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
    at /tmp/antimicro/src/x11extras.cpp:32
#3  0x0820691b in _GLOBAL__sub_I__ZN9X11Extras15mouseDeviceNameE ()
    at /tmp/antimicro/src/x11extras.cpp:864
#4  0x082299cd in __do_global_ctors_aux ()
#5  0x080c1c00 in _init ()
#6  0xb7fdc488 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

slackware64-current and qt5(-5.6.1):

└─$ export CFLAGS="-O0 -g -ggdb"; export CXXFLAGS="-O0 -g -ggdb"; mkdir -p build; cd build; cmake ../; make
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'sdl2'
--   Found sdl2, version 2.0.4
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so                                    
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found                            
-- Looking for gethostbyname                                                                                 
-- Looking for gethostbyname - found                                                                         
-- Looking for connect                                                                                       
-- Looking for connect - found                                                                               
-- Looking for remove                                                                                        
-- Looking for remove - found                                                                                
-- Looking for shmat                                                                                         
-- Looking for shmat - found                                                                                 
-- Looking for IceConnectionNumber in ICE                                                                    
-- Looking for IceConnectionNumber in ICE - found                                                            
-- Found X11: /usr/lib64/libX11.so                                                                           
XTest support allowed for simulating events.
Compiling with Qt5 support
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/antimicro/build
Scanning dependencies of target antimicro_automoc

...

[ 98%] Building CXX object CMakeFiles/antimicro.dir/qrc_resources.cpp.o
[100%] Building CXX object CMakeFiles/antimicro.dir/antimicro_automoc.cpp.o
[100%] Linking CXX executable bin/antimicro
[100%] Built target antimicro
└─$ gdb ./antimicro
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-slackware-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./antimicro...done.
(gdb) r
Starting program: /tmp/antimicro/build/bin/antimicro 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00000000004af56a in QGenericAtomicOps<QBasicAtomicOps<4> >::load<int> (
    _q_value=@0x0: <error reading variable>) at /usr/include/qt5/QtCore/qgenericatomic.h:83
83              return _q_value;
(gdb) thread apply all backtrace

Thread 1 (Thread 0x7ffff7f9d740 (LWP 5450)):
#0  0x00000000004af56a in QBasicAtomicInteger<int>::load() const (_q_value=@0x0: <error reading variable>)
    at /usr/include/qt5/QtCore/qgenericatomic.h:83
#1  0x00000000004af56a in QBasicAtomicInteger<int>::load() const (this=0x0)
    at /usr/include/qt5/QtCore/qbasicatomic.h:116
#2  0x00000000004aebd8 in QtPrivate::RefCount::ref() (this=0x0) at /usr/include/qt5/QtCore/qrefcount.h:49
#3  0x00000000004aef81 in QString::QString(QString const&) (this=0x8efcc0 <X11Extras::mouseDeviceName>, other=...) at /usr/include/qt5/QtCore/qstring.h:890
#4  0x0000000000616001 in __static_initialization_and_destruction_0(int, int) (__initialize_p=1, __priority=65535) at /tmp/antimicro/src/x11extras.cpp:32
#5  0x00000000006161ed in _GLOBAL__sub_I_x11extras.cpp(void) () at /tmp/antimicro/src/x11extras.cpp:864
#6  0x000000000063b3c6 in __do_global_ctors_aux ()
#7  0x0000000000000000 in  ()
(gdb) 
jsbackus commented 8 years ago

Thanks for reporting this! Hmm.. Does it segfault immediately on startup? And just to be clear, by "git current" you mean latest in master (as opposed to downloading a release)?

slacknk commented 8 years ago

Does it segfault immediately on startup?

immediately

...latest in master ...a release

This segfault since Ryochan7/antimicro version 2.21 (on slackware). I've tried to build 2.21 by hands: it's also failed, but version 2.20.2 of antimicro works.

My SlackBuild for Make the package: https://github.com/slacknk/slackware/blob/master/slackbuilds/_games/antimicro/antimicro.SlackBuild

//sorry for bad english

jsbackus commented 8 years ago

Thanks!

My SlackBuild for ...

Very helpful! I don't see any problems in your SlackBuild... I'll try installing 14.2 in a VM and see if I can track it down...

//sorry for bad english

Not a problem! I apologize for not having very much time to work on this. It may take a little while for me to track this down. Thanks for such a detailed bug report. :smile:

jsbackus commented 8 years ago

You know, I don't think I've used Slack since the kernel was at 2.2. Brings back memories. ... and wow, Fedora has really spoiled me! :innocent:

jsbackus commented 8 years ago

Good news - I'm able to reproduce it in a VM with slackware 14.2 32bit. Trying to track down the commit that broke things...

jsbackus commented 8 years ago

Looks like the problem was introduced in commit 05413d0...

jsbackus commented 8 years ago

Looks like issues are in src/common.h and src/common.cpp. @Ryochan7 converted them from const QString to extern QString. Not sure why... hmm...

Possible fix in commit 883a2037b.

jsbackus commented 8 years ago

Hi, @slacknk. I think I have a fix. Would you please try the dev branch? i.e. change line 140 of your SlackBuild to use origin/dev instead of origin/master. (This is temporary, you'll want to change it back after we're done). Thanks!

slacknk commented 8 years ago

Thx, it's works. Tried to build and started on slackware32-14.2 (upgrated 14.1) - I've tried to build origin/dev of antimicro works. And tried to build with qt4 and 5.

use origin/dev instead of origin/master.

Hmm, maybe for first time created and shared patches for slackware (qt_slack)?..

~upd

Tried to build on slackware64 14.2/current (qt5 + kde5) - works fine!

2.21
SDL 2.0.4 
Qt 5.6.1
Using Event Handler: XTest
jsbackus commented 8 years ago

@slacknk Great! I'm so glad it works!

use origin/dev instead of origin/master.

Hmm, maybe for first time created and shared patches for slackware (qt_slack)?..

Yes, origin/master will contain the latest stable but unreleased and origin/dev will contain the latest work that may not work.

Thanks again for all of your help!

slacknk commented 8 years ago

@jsbackus , hi, i'm about https://github.com/AntiMicro/antimicro/commit/6f241c9b9fa4e884f48ce3882db664883270865f maintainer from _SBo is not I'm, maybe in README.md: "AntiMicro is currently available for SlackWare via SlackBuilds, thanks to NK and Klaatu"

and SlackWare -> Slackware "AntiMicro is currently available for Slackware via SlackBuilds, thanks to NK and Klaatu"

or just "AntiMicro is currently available for Slackware via SlackBuilds, thanks to Klaatu"

... and command(s), how from Fedora/Download section: # sbopkg -i antimicro link too https://slackbuilds.org/result/?search=antimicro&sv=

AntiMicro is currently available for Slackware via SlackBuilds, thanks to NK and Klaatu https://slackbuilds.org/result/?search=antimicro&sv= # sbopkg -i antimicro

jsbackus commented 8 years ago

@slacknk Whoops! Thanks for the correction! I've updated the README. My apologies!

slacknk commented 8 years ago

Thx) Ok, But one moment maybe without

sbopkg -i antimicro

Now i'm know is not full commands for install, antimico require: SDL2 ...without this commands, ...or

AntiMicro is currently available for Slackware via SlackBuilds, thanks to NK and Klaatu: https://slackbuilds.org/result/?search=antimicro&sv=

and top/up for Fedora # SuDo: $ sudo dnf install antimicro

or just, w/o

AntiMicro is currently available for Slackware via SlackBuilds, thanks to NK and Klaatu: https://slackbuilds.org/result/?search=antimicro&sv=

And i'm try contacts with Klaatu for slack_SBo updates) this time

jsbackus commented 8 years ago

@slacknk ah, yes, good point. Yes, we would need the command for a full install. I think you're right, we might be better off with just the link. I've updated the README again. Would you please check it? Thanks!

slacknk commented 8 years ago

checked, allright and thanks for release and continued dev

~upd // oh, not about slackware. In Desc:

This program is currently supported under various Linux distributions, Windows (Vista and later), and FreeBSD. At the time of writing this, antimicro works in Windows XP but, since Windows XP is no longer supported, running the program in Windows XP will not be officially supported. However, efforts will be made to not intentionally break compatibility with Windows XP.

Also, FreeBSD support will be minimal for now. I don't use BSD on a daily basis so the main support for FreeBSD is being offered by Anton. He has graciously made a port of antimicro for FreeBSD that you can find at the following URL: http://www.freshports.org/x11/antimicro/.

Next time, maybe this is in Download section ?.. or w/o Win, only about FreeBSD http://www.freshports.org/x11/antimicro/

jsbackus commented 8 years ago

@slacknk Ooooh. Good point. That FreeBSD version is quite out of date and the homepage needs updated. I'll e-mail them. Thanks!