OpenGL application that reacts weirdly (Help) Debugging?

I have compiled an OpenGL app that use SDL, OpenAL and others librarys…I have took the sources from a linux application.

Build with Cmake && make

The compilation doesn’t give me an error, just a warning about something (which seems superfluous at the moment). But the application does not run through the window manager of Haiku, gives me an error (not precise)and propose to debug the app … But it runs from a terminal with no errors at it seems.

I don’t understand why it reacts like that. Someone can help me about this kind of trouble?

It’s a graphical app. (SDL/OpengL context)

Haiku SDL2 port is not yet complete (especially OpenGL part), it contains serious problems.

But the application does not run through the window manager of Haiku, gives me an error (not precise)and propose to debug the app

Click “save report” and paste it here. Crash reports are saved on desktop by default.

This usually happens because the application expects to be run with the current working directory set to the directory where the executable is. This is not the case when applications are run from Tracker, instead they start with the current directory being the home folder.

So, the application needs to look for its own files.

One simple fix is to add chdir(dirname(basename(argv[0]))); at the start of the function.
This does:

  • Take the application path from argv[0]
  • Resolve it if it is a symlink (for example if the app is started from a link in DeskBar)
  • Find the parent directory
  • Set that to be the current directory

Then the app can find its own files.

X512
Click “save report” and paste it here. Crash reports are saved on desktop by default.

This is the report:

Debug information for team /boot/home/Desktop/OpenTomb/OpenTomb-master/OpenTomb (686):
CPU(s): 2x AMD Athlon™ 4450B
Memory: 8.00 GiB total, 480.85 MiB used
Haiku revision: hrev53725 Jan 18 2020 07:56:32 (x86_64)

Active Threads:
	thread 687: SDLApplication 
	thread 691: direct daemon 
	thread 692: drawing_thread 
	thread 693: w>OpenTomb 
	thread 694: pthread func 
	thread 695: pthread func 
	thread 696: team 686 debug task 
	thread 686: OpenTomb (main)
		state: Call (abort() called)

		Frame		IP			Function Name
		-----------------------------------------------
		00000000	0x389234d54f	_kern_debugger + 0x7 
			Disassembly:
				_kern_debugger:
				0x000000389234d548:   48c7c0e1000000  mov $0xe1, %rax
				0x000000389234d54f:             0f05  syscall  <--

		0x7ffe12e6aa70	0x3892345023	abort + 0x4a 
		0x7ffe12e6aeb0	0x39eaae3f5f	shader_stage::shader_stage(unsigned int, char const*, char const*) + 0xdb 
		0x7ffe12e6b0a0	0x39eaae43ab	shader_manager::shader_manager() + 0x2f 
		0x7ffe12e6b0d0	0x39eaad9b3b	CRender::DoShaders() + 0x2f 
		0x7ffe12e6b110	0x39eab44b59	Engine_Start(int, char**) + 0x2bb 
		0x7ffe12e6b130	0x39eab575fd	main + 0x1b 
		0x7ffe12e6b160	0x39eaa859d9	_start + 0x39 
		0x7ffe12e6b190	0x1a7cfb89583	runtime_loader + 0x103 
		00000000	0x7fb0104ad260	commpage_thread_exit + 0 

		Registers:
			  rip:	0x000000389234d551
			  rsp:	0x00007ffe12e6aa38
			  rbp:	0x00007ffe12e6aa60
			  rax:	0x00000000000000e1
			  rbx:	0x0000010161f1c570
			  rcx:	0x000000389234d551
			  rdx:	0x00007ffe12e6a53e
			  rsi:	0x0000000000000001
			  rdi:	0x000000389244edf8
			   r8:	0x00007ffe12e67f05
			   r9:	0x00000000fffffff2
			  r10:	0x000000389244edf8
			  r11:	0x0000000000003206
			  r12:	0x0000000000000001
			  r13:	0x00007ffe12e6c658
			  r14:	0x0000000000000000
			  r15:	0x0000000000000000
			   cs:	0x002b
			   ds:	0x0000
			   es:	0x0000
			   fs:	0x0000
			   gs:	0x0000
			   ss:	0x0023
			  st0:	0
			  st1:	0
			  st2:	0
			  st3:	0
			  st4:	0
			  st5:	0
			  st6:	0
			  st7:	0
			  mm0:	{0, 0, 0, 0}
			  mm1:	{0, 0, 0, 0}
			  mm2:	{0, 0, 0, 0}
			  mm3:	{0, 0, 0, 0}
			  mm4:	{0, 0, 0, 0}
			  mm5:	{0, 0, 0, 0}
			  mm6:	{0, 0, 0, 0}
			  mm7:	{0, 0, 0, 0}
			 xmm0:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm1:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm2:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm3:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm4:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm5:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm6:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm7:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm8:	{0, 0, 0, 0, 0, 0, 0, 0}
			 xmm9:	{0, 0, 0, 0, 0, 0, 0, 0}
			xmm10:	{0, 0, 0, 0, 0, 0, 0, 0}
			xmm11:	{0, 0, 0, 0, 0, 0, 0, 0}
			xmm12:	{0, 0, 0, 0, 0, 0, 0, 0}
			xmm13:	{0, 0, 0, 0, 0, 0, 0, 0}
			xmm14:	{0, 0, 0, 0, 0, 0, 0, 0}
			xmm15:	{0, 0, 0, 0, 0, 0, 0, 0}

Loaded Images:
	ID		Text Base	Text End	Data Base	Data End	Type	Name
	--------------------------------------------------------------------------------
	2358	0xd74143000	0xd74197000	0xd74397000	0xd7439a000	lib    	/boot/system/lib/libicule.so.57.2
	2344	0x12ae037000	0x12ae199000	0x12ae399000	0x12ae3ad000	lib    	/boot/system/lib/libstdc++.so.6.0.25
	2365	0x223b073000	0x223b632000	0x223b831000	0x223b8d7000	add-on 	/boot/system/add-ons/opengl/Software Pipe
	2353	0x2b3ae9e000	0x2b3aeac000	0x2b3b0ac000	0x2b3b0ad000	lib    	/boot/system/lib/libdevice.so
	2348	0x2da7ed8000	0x2da81ec000	0x2da83eb000	0x2da8419000	lib    	/boot/system/lib/libbe.so
	2346	0x389230b000	0x3892469000	0x3892668000	0x38926bb000	lib    	/boot/system/lib/libroot.so
	2339	0x39ea9e2000	0x39ead11000	0x39eaf10000	0x39eaf2b000	app    	/boot/home/Desktop/OpenTomb/OpenTomb-master/OpenTomb
	2343	0x4403fe7000	0x4404108000	0x4404307000	0x4404311000	lib    	/boot/system/lib/libSDL2-2.0.so.0.10.0
	2360	0x4f00dc8000	0x4f00df6000	0x4f00ff6000	0x4f0102a000	lib    	/boot/system/lib/libicutu.so.57.2
	2345	0x7c9b3a7000	0x7c9b3bd000	0x7c9b5bc000	0x7c9b5bd000	lib    	/boot/system/lib/libgcc_s.so.1
	2368	0x8fd4f48000	0x8fd8992000	0x8fd8b92000	0x8fd8fe4000	lib    	/boot/system/lib/libLLVM-7.so
	2340	0x9d101e5000	0x9d10216000	0x9d10415000	0x9d10416000	lib    	/boot/system/lib/libpng16.so.16.37.0
	2366	0xd38475e000	0xd384773000	0xd384972000	0xd384974000	lib    	/boot/system/lib/libtranslation.so
	2362	0xf0e9afc000	0xf0e9bc5000	0xf0e9dc4000	0xf0e9dc5000	lib    	/boot/system/lib/libzstd.so.1.4.4
	2361	0x111fe325000	0x111fe4b9000	0x111fe6b9000	0x111fe6ce000	lib    	/boot/system/lib/libicuuc.so.57.2
	2356	0x116a9a8e000	0x116a9d0a000	0x116a9f0a000	0x116a9f1f000	lib    	/boot/system/lib/libicui18n.so.57.2
	2354	0x11a4b7e8000	0x11a4b8e3000	0x11a4bae2000	0x11a4bae5000	lib    	/boot/system/lib/libtextencoding.so
	2351	0x127f722a000	0x127f72af000	0x127f74af000	0x127f74c2000	lib    	/boot/system/lib/libGL.so.1.0.0
	2357	0x130559f0000	0x130559fc000	0x13055bfb000	0x13055bfd000	lib    	/boot/system/lib/libicuio.so.57.2
	2349	0x131c992f000	0x131c9934000	0x131c9b33000	0x131c9b35000	lib    	/boot/system/lib/libatomic.so.1.2.0
	2342	0x13fff1dd000	0x13fff2a5000	0x13fff4a4000	0x13fff4ac000	lib    	/boot/system/lib/libopenal.so.1.19.1
	2367	0x1541f2eb000	0x1541f32c000	0x1541f52b000	0x1541f534000	lib    	/boot/system/lib/libnetwork.so
	2359	0x19387bd4000	0x19387bdf000	0x19387ddf000	0x19387de0000	lib    	/boot/system/lib/libiculx.so.57.2
	2355	0x1a0aeec9000	0x1a0b0749000	0x1a0b0948000	0x1a0b0949000	lib    	/boot/system/lib/libicudata.so.57.2
	2341	0x1a288f49000	0x1a288f65000	0x1a289164000	0x1a289165000	lib    	/boot/system/lib/libz.so.1.2.11
	2338	0x1a7cfb75000	0x1a7cfb96000	0x1a7cfd95000	0x1a7cfd97000	lib    	/boot/system/runtime_loader
	2347	0x1b53675c000	0x1b53680f000	0x1b536a0f000	0x1b536a1b000	lib    	/boot/system/lib/libmedia.so
	2369	0x203abcef000	0x203abcf6000	0x203abef5000	0x203abef6000	lib    	/boot/system/lib/libbsd.so
	2352	0x21a4595a000	0x21a4597b000	0x21a45b7b000	0x21a45b7e000	lib    	/boot/system/lib/libgame.so
	2350	0x255d513b000	0x255d5144000	0x255d5343000	0x255d5344000	lib    	/boot/system/lib/libltdl.so.7.3.1
	2337	0x7fb0104ad000	0x7fb0104b5000	0x00000000	0x00000000	system 	commpage

Areas:
	ID		Base		End			Size (KiB)	Protection	Locking			Name
	--------------------------------------------------------------------------------
	6618	0x00100000	0x00101000	         4	r--S       	full          	cloned direct area
	6639	0x01475000	0x014bd000	       288	rw-        	full          	rld heap
	6638	0x0189f000	0x018e7000	       288	rw-        	full          	rld heap
	6600	0x08ef8000	0x08f10000	        96	rw-        	full          	rld heap
	6599	0x11366000	0x1137e000	        96	rw-        	full          	rld heap
	6598	0x13766000	0x13776000	        64	rw-        	full          	rld heap
	6597	0x14c01000	0x14c11000	        64	rw-        	full          	rld heap
	6612	0x60000000	0x60001000	         4	rw-S, u:(0x100)	full          	server_memory
	6614	0x68000000	0x68020000	       128	rw-S, u:(0x100)	full          	server_memory
	6647	0x78000000	0x781d5000	      1876	rw-S, u:(0x100)	full          	server_memory
	6596	0x238919000	0x238921000	        32	rw-        	full          	rld heap
	6595	0xce0884000	0xce088c000	        32	rw-        	full          	rld heap
	6584	0xd74143000	0xd74197000	       336	r-x        	full          	libicule.so.57.2_seg0ro
	6585	0xd74397000	0xd7439a000	        12	rw-        	full          	libicule.so.57.2_seg1rw
	6553	0x12ae037000	0x12ae199000	      1416	r-x        	full          	libstdc++.so.6.0.25_seg0ro
	6554	0x12ae399000	0x12ae3a5000	        48	rw-        	full          	libstdc++.so.6.0.25_seg1rw
	6555	0x12ae3a5000	0x12ae3ad000	        32	rw-        	full          	libstdc++.so.6.0.25_seg2rw
	6625	0x223b073000	0x223b632000	      5884	r-x        	full          	Software Pipe_seg0ro
	6626	0x223b831000	0x223b866000	       212	rw-        	full          	Software Pipe_seg1rw
	6627	0x223b866000	0x223b8d7000	       452	rw-        	full          	Software Pipe_seg2rw
	6574	0x2b3ae9e000	0x2b3aeac000	        56	r-x        	full          	libdevice.so_seg0ro
	6575	0x2b3b0ac000	0x2b3b0ad000	         4	rw-        	full          	libdevice.so_seg1rw
	6563	0x2da7ed8000	0x2da81ec000	      3152	r-x        	full          	libbe.so_seg0ro
	6564	0x2da83eb000	0x2da8419000	       184	rw-        	full          	libbe.so_seg1rw
	6558	0x389230b000	0x3892469000	      1400	r-x        	full          	libroot.so_seg0ro
	6559	0x3892668000	0x3892677000	        60	rw-        	full          	libroot.so_seg1rw
	6560	0x3892677000	0x38926bb000	       272	rw-        	full          	libroot.so_seg2rw
	6540	0x39ea9e2000	0x39ead11000	      3260	r-x        	full          	OpenTomb_seg0ro
	6541	0x39eaf10000	0x39eaf24000	        80	rw-        	full          	OpenTomb_seg1rw
	6542	0x39eaf24000	0x39eaf2b000	        28	rw-        	full          	OpenTomb_seg2rw
	6539	0x3e358ae000	0x3e358af000	         4	rw-S, u:(0x100)	full          	_rld_debug_
	6550	0x4403fe7000	0x4404108000	      1156	r-x        	full          	libSDL2-2.0.so.0.10.0_seg0ro
	6551	0x4404307000	0x440430f000	        32	rw-        	full          	libSDL2-2.0.so.0.10.0_seg1rw
	6552	0x440430f000	0x4404311000	         8	rw-        	full          	libSDL2-2.0.so.0.10.0_seg2rw
	6538	0x4e39c56000	0x4e39c66000	        64	rw-        	full          	rld heap
	6588	0x4f00dc8000	0x4f00df6000	       184	r-x        	full          	libicutu.so.57.2_seg0ro
	6589	0x4f00ff6000	0x4f00ff8000	         8	rw-        	full          	libicutu.so.57.2_seg1rw
	6590	0x4f00ff8000	0x4f0102a000	       200	rw-        	full          	libicutu.so.57.2_seg2rw
	6556	0x7c9b3a7000	0x7c9b3bd000	        88	r-x        	full          	libgcc_s.so.1_seg0ro
	6557	0x7c9b5bc000	0x7c9b5bd000	         4	rw-        	full          	libgcc_s.so.1_seg1rw
	6633	0x8fd4f48000	0x8fd8992000	     59688	r-x        	full          	libLLVM-7.so_seg0ro
	6634	0x8fd8b92000	0x8fd8f84000	      4040	rw-        	full          	libLLVM-7.so_seg1rw
	6635	0x8fd8f84000	0x8fd8fe4000	       384	rw-        	full          	libLLVM-7.so_seg2rw
	6543	0x9d101e5000	0x9d10216000	       196	r-x        	full          	libpng16.so.16.37.0_seg0ro
	6544	0x9d10415000	0x9d10416000	         4	rw-        	full          	libpng16.so.16.37.0_seg1rw
	6628	0xd38475e000	0xd384773000	        84	r-x        	full          	libtranslation.so_seg0ro
	6629	0xd384972000	0xd384974000	         8	rw-        	full          	libtranslation.so_seg1rw
	6593	0xf0e9afc000	0xf0e9bc5000	       804	r-x        	full          	libzstd.so.1.4.4_seg0ro
	6594	0xf0e9dc4000	0xf0e9dc5000	         4	rw-        	full          	libzstd.so.1.4.4_seg1rw
	6601	0x10160e4a000	0x1016349a000	     39232	rw-, u:(0x100)	full          	heap
	6591	0x111fe325000	0x111fe4b9000	      1616	r-x        	full          	libicuuc.so.57.2_seg0ro
	6592	0x111fe6b9000	0x111fe6ce000	        84	rw-        	full          	libicuuc.so.57.2_seg1rw
	6580	0x116a9a8e000	0x116a9d0a000	      2544	r-x        	full          	libicui18n.so.57.2_seg0ro
	6581	0x116a9f0a000	0x116a9f1f000	        84	rw-        	full          	libicui18n.so.57.2_seg1rw
	6576	0x11a4b7e8000	0x11a4b8e3000	      1004	r-x        	full          	libtextencoding.so_seg0ro
	6577	0x11a4bae2000	0x11a4bae5000	        12	rw-        	full          	libtextencoding.so_seg1rw
	6569	0x127f722a000	0x127f72af000	       532	r-x        	full          	libGL.so.1.0.0_seg0ro
	6570	0x127f74af000	0x127f74c0000	        68	rw-        	full          	libGL.so.1.0.0_seg1rw
	6571	0x127f74c0000	0x127f74c2000	         8	rw-        	full          	libGL.so.1.0.0_seg2rw
	6582	0x130559f0000	0x130559fc000	        48	r-x        	full          	libicuio.so.57.2_seg0ro
	6583	0x13055bfb000	0x13055bfd000	         8	rw-        	full          	libicuio.so.57.2_seg1rw
	6565	0x131c992f000	0x131c9934000	        20	r-x        	full          	libatomic.so.1.2.0_seg0ro
	6566	0x131c9b33000	0x131c9b35000	         8	rw-        	full          	libatomic.so.1.2.0_seg1rw
	6547	0x13fff1dd000	0x13fff2a5000	       800	r-x        	full          	libopenal.so.1.19.1_seg0ro
	6548	0x13fff4a4000	0x13fff4a8000	        16	rw-        	full          	libopenal.so.1.19.1_seg1rw
	6549	0x13fff4a8000	0x13fff4ac000	        16	rw-        	full          	libopenal.so.1.19.1_seg2rw
	6630	0x1541f2eb000	0x1541f32c000	       260	r-x        	full          	libnetwork.so_seg0ro
	6631	0x1541f52b000	0x1541f52e000	        12	rw-        	full          	libnetwork.so_seg1rw
	6632	0x1541f52e000	0x1541f534000	        24	rw-        	full          	libnetwork.so_seg2rw
	6586	0x19387bd4000	0x19387bdf000	        44	r-x        	full          	libiculx.so.57.2_seg0ro
	6587	0x19387ddf000	0x19387de0000	         4	rw-        	full          	libiculx.so.57.2_seg1rw
	6578	0x1a0aeec9000	0x1a0b0749000	     25088	r-x        	full          	libicudata.so.57.2_seg0ro
	6579	0x1a0b0948000	0x1a0b0949000	         4	rw-        	full          	libicudata.so.57.2_seg1rw
	6545	0x1a288f49000	0x1a288f65000	       112	r-x        	full          	libz.so.1.2.11_seg0ro
	6546	0x1a289164000	0x1a289165000	         4	rw-        	full          	libz.so.1.2.11_seg1rw
	6536	0x1a7cfb75000	0x1a7cfb96000	       132	r-x        	full          	runtime_loader_seg0ro
	6537	0x1a7cfd95000	0x1a7cfd97000	         8	rw-        	full          	runtime_loader_seg1rw
	6561	0x1b53675c000	0x1b53680f000	       716	r-x        	full          	libmedia.so_seg0ro
	6562	0x1b536a0f000	0x1b536a1b000	        48	rw-        	full          	libmedia.so_seg1rw
	6636	0x203abcef000	0x203abcf6000	        28	r-x        	full          	libbsd.so_seg0ro
	6637	0x203abef5000	0x203abef6000	         4	rw-        	full          	libbsd.so_seg1rw
	6572	0x21a4595a000	0x21a4597b000	       132	r-x        	full          	libgame.so_seg0ro
	6573	0x21a45b7b000	0x21a45b7e000	        12	rw-        	full          	libgame.so_seg1rw
	6567	0x255d513b000	0x255d5144000	        36	r-x        	full          	libltdl.so.7.3.1_seg0ro
	6568	0x255d5343000	0x255d5344000	         4	rw-        	full          	libltdl.so.7.3.1_seg1rw
	6643	0x7f539a2af000	0x7f539a2f4000	       276	rw-s       	full          	pthread func_695_stack
	6620	0x7f675a22b000	0x7f675a270000	       276	rw-s       	full          	direct daemon_691_stack
	6622	0x7face432c000	0x7face4371000	       276	rw-s       	full          	drawing_thread_692_stack
	6535	0x7fb0104ad000	0x7fb0104b5000	        32	r-xS       	full          	commpage
	6641	0x7fc2d7c29000	0x7fc2d7c6e000	       276	rw-s       	full          	pthread func_694_stack
	6607	0x7fd1fec39000	0x7fd1fec7e000	       276	rw-s       	full          	pthread func_687_stack
	6532	0x7fdc4506e000	0x7fdc45072000	        16	rw-        	full          	user area
	6624	0x7ffd7bbb3000	0x7ffd7bbf8000	       276	rw-s       	full          	w>Untitled_693_stack
	6534	0x7ffe11e6c000	0x7ffe12e6d000	     16388	rw-s       	full          	OpenTomb_686_stack

Protection Flags: r - read, w - write, x - execute, s - stack, o - overcommit, c - cloneable, S - shared, k - kernel

Semaphores:
	ID		Count	Last Holder	Name
	------------------------------------------------------------
	3714	    0	          0	some BBlockCache lock
	3715	    0	          0	token space
	3716	    0	          0	BLooperList lock
	3717	    0	        687	AppServerLink_sLock
	3718	    0	          0	some BLocker
	3719	    0	          0	some BLocker
	3720	    0	          0	Catalog
	3721	    0	          0	LocaleRosterData
	3722	    0	          0	some BLocker
	3723	    0	          0	some BLocker
	3724	    0	          0	BMediaRoster::Roster locker
	3725	    0	          0	port pool
	3726	    0	          0	media theme lock
	3727	    0	          0	add-on manager
	3728	    0	          0	shared buffer list
	3729	    0	          0	media plugin manager
	3730	    0	          0	GameSound device lock
	3731	    0	          0	Catalog
	3735	    0	          0	BMessageQueue Lock
	3736	    0	          0	AppLooperPort
	3748	    0	          0	screen list
	3749	    0	          0	clipboard
	3750	    0	          0	width buffer
	3751	    0	          0	BMessageQueue Lock
	3752	    0	        693	Untitled
	3763	    0	          0	some BLocker
	3770	    0	          0	BGLView draw lock
	3771	    0	          0	BGLView display lock
	3772	    0	          0	info locker
	3779	    0	          0	tool tip manager

PulkoMandy

6h

Kitsune64:

But it runs from a terminal with no errors at it seems.

This usually happens because the application expects to be run with the current working directory set to the directory where the executable is. This is not the case when applications are run from Tracker, instead they start with the current directory being the home folder.

So, the application needs to look for its own files.

One simple fix is to add chdir(dirname(basename(argv[0]))); at the start of the function.
This does:

  • Take the application path from argv[0]
  • Resolve it if it is a symlink (for example if the app is started from a link in DeskBar)
  • Find the parent directory
  • Set that to be the current directory

Then the app can find its own files.

Thanks that will be helpfull…I run the app directly where the cmake have created the executable file.
But if I understand, I must take a look in the sources of the file and try to search a function and put something batout it…chdir(dirname(basename(argv[0])));

I saw this also in the terminal when I run the app from it. (the app run but give me this in the same way in the terminal)

~/Desktop/OpenTomb/OpenTomb-master> OpenTomb
GalliumContext: CreateScreen: Using llvmpipe (LLVM 7.0, 128 bits) driver.
AL lib: (WW) GetProcBinary: Failed to readlink /proc/curproc/file: No such file or directory
AL lib: (WW) alc_initconfig: No capture backend available!
AL lib: (WW) alSetError: Error generated on context 0x24376e28f60, code 0xa003, "Listener velocity out of range"
Kill Thread
~/Desktop/OpenTomb/OpenTomb-master> 

That seem related to the OpenAL library and a link GetProcBinary that as about I think Linux system directory but not sure…Maybe this is the directory where the app is suppose to be in a Linux system don’t sure about it…But in that case it will be linked to what PulkoMandy says.

I will be looking for details about these tips.
Thank you for your clarifications.