About Monkey 2 › Forums › Monkey 2 Programming Help › Ted2 won't run on Gnome (Archlinux)
This topic contains 37 replies, has 4 voices, and was last updated by
dawlane 2 years, 6 months ago.
-
AuthorPosts
-
October 8, 2016 at 8:49 pm #4346
So I went with my hunch from earlier and added a line to the empty New() method of class Style in mojo/style.monkey2 :
Monkey12348: Method New()9: _icons = New Image[1]10: EndAnd reran it through the debugger. The good news is I now get a window shown on screen (previously I got nothing at all). The bad news is the window is black and empty and there is a new segfault :
Monkey12345678910111213141516Reading symbols from ./ted2...done.(gdb) runStarting program: /home/arpie/Coding/Monkey/Monkey2/bin/ted2_linux/ted2[Thread debugging using libthread_db enabled]Using host libthread_db library "/usr/lib/libthread_db.so.1".[New Thread 0x7ffff064f700 (LWP 16358)][Thread 0x7ffff064f700 (LWP 16358) exited][New Thread 0x7ffff064f700 (LWP 16359)][New Thread 0x7fffebe4e700 (LWP 16360)]Thread 1 "ted2" received signal SIGSEGV, Segmentation fault.0x00000000005a3188 in t_mojox_FileBrowser::m_UpdateNode (this=this@entry=0x436dc88, l_node=0x4359130,l_path=..., l_recurse=l_recurse@entry=true)at /home/arpie/Coding/Monkey/Monkey2/modules/mojox/mojox.buildv1.0.7/linux_release/src/mojox_filebrowser.cpp:145145 if((l_i<f0.l_children->length())){(gdb)Any thoughts? I’m feeling quite out of my depth but willing to try anything to help…
October 8, 2016 at 9:05 pm #4347Can you enter ‘bt’ into gdb after the crash for a backtrace?
October 8, 2016 at 9:08 pm #4348Okay, I’m muddling on, hopefully in a vaguely useful direction. It seems that the above issue is related to line 170 of mojox/filebrowser.monkey2 and is entirely due to the variable children being null. If I change line 170 from :
Monkey1234567168: Local child:Node169:170: If i<children.Length171: child=Cast<Node>( children[i] )172: Else173: child=New Node( node )174: Endifto
Monkey1234567168: Local child:Node169:170: If children And i<children.Length171: child=Cast<Node>( children[i] )172: Else173: child=New Node( node )174: Endifthen the segfault goes away. But I suspect we need to address the reason why children is null and this is just a fudge. But, guess what, new segfault…!
Monkey12345678910111213141516Reading symbols from ./ted2...done.(gdb) runStarting program: /home/arpie/Coding/Monkey/Monkey2/bin/ted2_linux/ted2[Thread debugging using libthread_db enabled]Using host libthread_db library "/usr/lib/libthread_db.so.1".[New Thread 0x7ffff064f700 (LWP 16840)][Thread 0x7ffff064f700 (LWP 16840) exited][New Thread 0x7ffff064f700 (LWP 16841)][New Thread 0x7fffefe4e700 (LWP 16842)]SDL_WINDOWEVENT_FOCUS_GAINEDThread 1 "ted2" received signal SIGSEGV, Segmentation fault.0x00000000007b0473 in bbString::release (this=<optimized out>)at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbstring.h:4848 if( !--_rep->refs && _rep!=&_nullRep ) bbFree( _rep );(gdb)October 8, 2016 at 9:13 pm #4349Hello Mark. Do you want to see a backtrace of each of the segfaults I’ve mentioned so far? I can see this thread quickly getting messy if I try to retrace my steps with backtraces. Shall I start with a backtrace of the original segfault before I altered any mojo code? Are my further experiments any use to you?
October 8, 2016 at 9:17 pm #4350Here is a backtrace of the original segfault, with none of my edits to the mojo code :
Monkey123456789101112131415161718192021222324252627282930313233343536(gdb) runStarting program: /home/arpie/Coding/Monkey/Monkey2/bin/ted2_linux/ted2[Thread debugging using libthread_db enabled]Using host libthread_db library "/usr/lib/libthread_db.so.1".[New Thread 0x7ffff064f700 (LWP 17122)][Thread 0x7ffff064f700 (LWP 17122) exited][New Thread 0x7ffff064f700 (LWP 17123)][New Thread 0x7fffefe4e700 (LWP 17124)]Thread 1 "ted2" received signal SIGSEGV, Segmentation fault.0x000000000071d8d9 in t_mojo_app_Style::m_Init (this=this@entry=0x2c51458, l_style=l_style@entry=0x2c51308)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2style.cpp:166166 this->m__0textColor=t_std_graphics_Color(l_style->m__0textColor);(gdb) bt#0 0x000000000071d8d9 in t_mojo_app_Style::m_Init (this=this@entry=0x2c51458, l_style=l_style@entry=0x2c51308)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2style.cpp:166#1 0x000000000071dfb2 in t_mojo_app_Style::t_mojo_app_Style (this=0x2c51458, l_style=0x2c51308)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2style.cpp:29#2 0x0000000000716b46 in bbGCNew<t_mojo_app_Style, t_mojo_app_Style*> ()at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbobject.h:48#3 t_mojo_app_Theme::m_LoadStyle (this=this@entry=0xdea650, l_name=<optimized out>)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2theme.cpp:352#4 0x0000000000718217 in t_mojo_app_Theme::t_mojo_app_Theme (this=0xdea650, l_path=..., l_jobj=0x2c51248)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2theme.cpp:70#5 0x0000000000719500 in bbGCNew<t_mojo_app_Theme, bbString, t_std_json_JsonObject*> ()at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbobject.h:48#6 g_mojo_app_Theme_Load (l_path=...)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2theme.cpp:39#7 0x0000000000727166 in t_mojo_app_AppInstance::t_mojo_app_AppInstance (this=0xdfc1b8, l_config=<optimized out>)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2app.cpp:96#8 0x00000000004173dc in bbGCNew<t_mojo_app_AppInstance, t_std_collections_Map_1ss*> ()at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbobject.h:48#9 bbMain () at /home/arpie/Coding/Monkey/Monkey2/src/ted2/ted2.buildv1.0.7/linux_release/src/ted2_ted2.cpp:59#10 0x0000000000416a30 in main (argc=<optimized out>, argv=<optimized out>)at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbmonkey.cpp:71@Mark: I will await further instructions from you before doing anything else!
October 8, 2016 at 9:43 pm #4351Can you try rebuilding all using ‘-O2’ optimizations instead of ‘-O3’? If it still fails, try ‘-O1’.
Are your OS, compilers etc up to date?
October 8, 2016 at 9:51 pm #4352is the field declaration sufficient to allocate memory for an empty array?
Yes, a ‘null’ array in mx2 is really just an array of length 0, ditto strings.
Does that mean that
Monkey1Field blah:Image[]is equivalent to
Monkey1Field blah:Image[] = New Image[0]?
October 8, 2016 at 9:54 pm #4353Also, can you email me the crashing version of ted2, ie: the ‘bin/ted2_linux/ted2’ file?
Argh, you probably can’t ‘coz I’m on gmail – can you stick it somewhere I can download it?
October 8, 2016 at 10:07 pm #4354Yes, OS and compilers are bang up to date. I came across the same issue with Ted2 when I tried a few months back but didn’t have the time to look into it then, and I’ve updated the OS at least twice since then, so that’s unlikely to be the cause.
Rebuilding with ‘-O2’ produced identical results to ‘-O3’.
Using ‘-O1’ still segfaults but differently :
Monkey123456789101112131415161718192021222324252627282930313233343536(gdb) runStarting program: /home/arpie/Coding/Monkey/Monkey2/bin/ted2_linux/ted2[Thread debugging using libthread_db enabled]Using host libthread_db library "/usr/lib/libthread_db.so.1".[New Thread 0x7ffff064f700 (LWP 27681)][Thread 0x7ffff064f700 (LWP 27681) exited][New Thread 0x7ffff064f700 (LWP 27682)][New Thread 0x7fffefe4e700 (LWP 27683)]Thread 1 "ted2" received signal SIGSEGV, Segmentation fault.t_mojo_app_Style::m_Init (this=this@entry=0x29f7458, l_style=l_style@entry=0x29f7308)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2style.cpp:168168 this->m__0icons=l_style->m__0icons->slice(bbInt(0));(gdb) bt#0 t_mojo_app_Style::m_Init (this=this@entry=0x29f7458, l_style=l_style@entry=0x29f7308)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2style.cpp:168#1 0x00000000005c56c9 in t_mojo_app_Style::t_mojo_app_Style (this=0x29f7458, l_style=0x29f7308)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2style.cpp:29#2 0x00000000005c0cb6 in bbGCNew<t_mojo_app_Style, t_mojo_app_Style*> ()at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbobject.h:48#3 t_mojo_app_Theme::m_LoadStyle (this=this@entry=0xb90650, l_name=<optimized out>)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2theme.cpp:352#4 0x00000000005c198f in t_mojo_app_Theme::t_mojo_app_Theme (this=0xb90650, l_path=..., l_jobj=0x29f7248)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2theme.cpp:70#5 0x00000000005c28ce in bbGCNew<t_mojo_app_Theme, bbString, t_std_json_JsonObject*> (a#0=..., a#1=0x29f7248)at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbobject.h:48#6 0x00000000005c20ac in g_mojo_app_Theme_Load (l_path=...)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2theme.cpp:39#7 0x00000000005c95ac in t_mojo_app_AppInstance::t_mojo_app_AppInstance (this=0xba21b8, l_config=<optimized out>)at /home/arpie/Coding/Monkey/Monkey2/modules/mojo/mojo.buildv1.0.7/linux_release/src/mojo_app_2app.cpp:96#8 0x000000000040bee6 in bbGCNew<t_mojo_app_AppInstance, t_std_collections_Map_1ss*> ()at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbobject.h:48#9 bbMain () at /home/arpie/Coding/Monkey/Monkey2/src/ted2/ted2.buildv1.0.7/linux_release/src/ted2_ted2.cpp:59#10 0x0000000000777540 in main (argc=<optimized out>, argv=<optimized out>)at /home/arpie/Coding/Monkey/Monkey2/modules/monkey/native/bbmonkey.cpp:71(gdb)October 8, 2016 at 10:15 pm #4355Probably not much more I can do until I can reproduce it.
That’s the bummer about linux – it’s like supporting 10 OS’s at once!
is equivalent to
yep, these are all effectively the same:
Local t:Int[]
Local t:Int[]=New Int[0]
Local t:Int[]=nullOctober 8, 2016 at 10:47 pm #4357Just to be sure, I tried building with ‘-O0’ and it runs as expected and appears fully functional. I guess that will have to do as a fix for now.
I have just uploaded the crashing binary (with build flag -O1) here :
http://www.arpie.co.uk/monkey/ted2
If you’d like me to send you a binary with -O3 too, just ask.
Or anything else I can do that might be helpful, just ask (russell (at) arpie.co.uk).
It has gone midnight here so I’m off to bed. Thanks again for looking into this – I know this is the sort of bug that is a pita to track down.
On a side note, another of Linux’s quirks annoys me every time I do a fresh Monkey install. All the *.sh files in /scripts, and the binary /bin/mx2cc all require the exec flag setting before I can run them(chmod a+x …). It’s easy enough to do, but I presume you could do it at your end to save me having to do it every time? Would you like me to make it a pull request on github (it’s about time I learnt how to)?
October 8, 2016 at 11:11 pm #4358Actually, I think I may have a clue what’s going on here – thanks for exe it should prove helpful.
October 8, 2016 at 11:40 pm #4359You probably suspected as much but all bananas appear show the same behaviour. That is, all the ones I tried : vpaint, monkeyroids, mojotest, glwindowtest.
In debug mode they run fine but in release mode they crash immediately with a memory access violation.
I’m really off to bed now!
Good luck.
October 9, 2016 at 9:02 am #4364Works in debug, but not release. Sound very much like BlitzMax under Linux with the later versions of GCC greater than 4.8.4. If I remember ArchLinux is a rolling release and would be using GCC 6.1.
@Mark: I would look at installing Manjaro as it’s based off ArchLinux and a hell of a lot simpler to setup, but still a pain when it comes to updates breaking the system.
If you don’t already know to see what optimisation are enabled by the -Ox switch use (x being the switch number:
Monkey1gcc -Ox -Q --help=optimizersto isolate individual optimisations use
Monkey1234gcc -O1 -Q --help=optimizers -xc - < /dev/null | grep vrp-ftree-vrp [disabled]gcc -O2 -Q --help=optimizers -xc - < /dev/null | grep vrp-ftree-vrp [enabled]Due to how mx2cc works, passing the -S option as part off the GCC command line to stop generation at the assembly stage will not work. You have to use objdump on a binary with symbols not stripped.
Monkey12objdump -S -d <app> > dump.txtOn a side note, another of Linux’s quirks annoys me every time I do a fresh Monkey install. All the *.sh files in /scripts, and the binary /bin/mx2cc all require the exec flag setting before I can run them(chmod a+x …).
If you download it as zip archive; then execute permissions are not saved. The same should be for cloning off of git.
Me being me. All I did was write a script to do the dirty work.
if [ -f master.zip ]; then rm -r master.zip; fi
if [ -d monkey2 ]; then rm -rf monkey2; fiwget -q https://github.com/blitz-research/monkey2/archive/master.zip
unzip master.zip
mv monkey2-master monkey2
SCRIPT_DIR=”$( cd “$( dirname “$0″ )” && pwd )”
ln -s $HOME/monkeyx/MonkeyX $SCRIPT_DIR/monkey2/devtools/MonkeyXFree86c
cd monkey2/scripts
chmod +x *
./rebuildall.shOctober 9, 2016 at 5:49 pm #4370I managed to reproduce this by installing/building with gcc-6.
There’s a quick ‘n’ dirty fix up now at github, let me know if it works!
-
AuthorPosts
You must be logged in to reply to this topic.