Jump to page: 1 2
Thread overview
[SDL + TKD] Seg fault from creating DirectoryDialog
Nov 02, 2014
Jack
Nov 02, 2014
Gary Willoughby
Nov 02, 2014
Jack
Nov 03, 2014
Gary Willoughby
Nov 03, 2014
Jack
Nov 04, 2014
Gary Willoughby
Nov 04, 2014
Jack
Nov 04, 2014
Mike Parker
Nov 04, 2014
Gary Willoughby
Nov 04, 2014
Gary Willoughby
Nov 04, 2014
Gary Willoughby
Nov 04, 2014
Jack
Nov 05, 2014
Gary Willoughby
November 02, 2014
Well, to start, I'm trying to create a mp3 player for "educational purposes".
I'm using DerelictSDL(SDL_MIXER) as a library for the backend and TKD for the GUI.

I have two objects to represent the two. The constructor for the sdl one contains the syntax for loading the DerelictSDL modules(DerelictSDL2.load()) and to initialize the SDL library (SDL_Init(SDL_INIT_EVERYTHING)), and the constructor for the TKD application initializes the sdl object.

// constructor for tkd
this() {
Sdl sdl = new Sdl();
}

//constructor for sdl
this(){
DerelictSDL2.load();
/*etc...*/
//

and I set a command function to a button that creates the DirectoryDialog.

at least, that's what it was supposed to do.

Whole error is: http://codepad.org/C2l4rUel

and gdb spews out a segmentation fault error:
http://codepad.org/X6CqH3vK
That, I think, revealed a threading conflict between the two libraries.

Can anybody with enough knowledge point me to the right direction? or just confirm what I have?
November 02, 2014
On Sunday, 2 November 2014 at 12:11:23 UTC, Jack wrote:
> Whole error is: http://codepad.org/C2l4rUel

That's not the true error. That's dub throwing an exception when trying to run the built executable. As shown here:

https://github.com/D-Programming-Language/dub/blob/master/source%2Fdub%2Fgenerators%2Fbuild.d#L464

I would suggest building the application without using dub then run the program through a debugger to find the location in the source where it's actually seg-faulting. I personally use this one: http://www.affinic.com/?page_id=109.
November 02, 2014
On Sunday, 2 November 2014 at 17:39:46 UTC, Gary Willoughby wrote:
> On Sunday, 2 November 2014 at 12:11:23 UTC, Jack wrote:
>> Whole error is: http://codepad.org/C2l4rUel
>
> That's not the true error. That's dub throwing an exception when trying to run the built executable. As shown here:
>
> https://github.com/D-Programming-Language/dub/blob/master/source%2Fdub%2Fgenerators%2Fbuild.d#L464
>
> I would suggest building the application without using dub then run the program through a debugger to find the location in the source where it's actually seg-faulting. I personally use this one: http://www.affinic.com/?page_id=109.

Thank you. I built the program using the compiler and debugged it
with the C::B gui version of gdb, and it spewed out information
about call stacks and things that, I confess, I have no idea what
the hell it is:
http://codepad.org/Bj3y6tqr

and it seems to point to line 123 in tcl.d as shown here:
http://picpaste.com/pics/Screenshot_from_2014-11-03_06_53_17-C6eIWp7k.1414969454.png

And now, as I said before, don't know what this is exactly.

November 03, 2014
On Sunday, 2 November 2014 at 23:05:05 UTC, Jack wrote:
> On Sunday, 2 November 2014 at 17:39:46 UTC, Gary Willoughby wrote:
>> On Sunday, 2 November 2014 at 12:11:23 UTC, Jack wrote:
>>> Whole error is: http://codepad.org/C2l4rUel
>>
>> That's not the true error. That's dub throwing an exception when trying to run the built executable. As shown here:
>>
>> https://github.com/D-Programming-Language/dub/blob/master/source%2Fdub%2Fgenerators%2Fbuild.d#L464
>>
>> I would suggest building the application without using dub then run the program through a debugger to find the location in the source where it's actually seg-faulting. I personally use this one: http://www.affinic.com/?page_id=109.
>
> Thank you. I built the program using the compiler and debugged it
> with the C::B gui version of gdb, and it spewed out information
> about call stacks and things that, I confess, I have no idea what
> the hell it is:
> http://codepad.org/Bj3y6tqr
>
> and it seems to point to line 123 in tcl.d as shown here:
> http://picpaste.com/pics/Screenshot_from_2014-11-03_06_53_17-C6eIWp7k.1414969454.png
>
> And now, as I said before, don't know what this is exactly.

Looks like a threading error somewhere. What version of Tcl/Tk are you linking against? Are you using threads in your program? Tcl/Tk can be a pain with threading as i've read. There exists thread-friendly versions as seen here: http://www.tcl.tk/doc/howto/compile.html Notice the --enable-threads switch.

I don't really know what to suggest. Try reducing the program down until you've found where the issue stops happening. It may be an incompatibility with SDL?
November 03, 2014
On Monday, 3 November 2014 at 14:32:07 UTC, Gary Willoughby wrote:
> On Sunday, 2 November 2014 at 23:05:05 UTC, Jack wrote:
>> On Sunday, 2 November 2014 at 17:39:46 UTC, Gary Willoughby wrote:
>>> On Sunday, 2 November 2014 at 12:11:23 UTC, Jack wrote:
>>>> Whole error is: http://codepad.org/C2l4rUel
>>>
>>> That's not the true error. That's dub throwing an exception when trying to run the built executable. As shown here:
>>>
>>> https://github.com/D-Programming-Language/dub/blob/master/source%2Fdub%2Fgenerators%2Fbuild.d#L464
>>>
>>> I would suggest building the application without using dub then run the program through a debugger to find the location in the source where it's actually seg-faulting. I personally use this one: http://www.affinic.com/?page_id=109.
>>
>> Thank you. I built the program using the compiler and debugged it
>> with the C::B gui version of gdb, and it spewed out information
>> about call stacks and things that, I confess, I have no idea what
>> the hell it is:
>> http://codepad.org/Bj3y6tqr
>>
>> and it seems to point to line 123 in tcl.d as shown here:
>> http://picpaste.com/pics/Screenshot_from_2014-11-03_06_53_17-C6eIWp7k.1414969454.png
>>
>> And now, as I said before, don't know what this is exactly.
>
> Looks like a threading error somewhere. What version of Tcl/Tk are you linking against? Are you using threads in your program? Tcl/Tk can be a pain with threading as i've read. There exists thread-friendly versions as seen here: http://www.tcl.tk/doc/howto/compile.html Notice the --enable-threads switch.
>
> I don't really know what to suggest. Try reducing the program down until you've found where the issue stops happening. It may be an incompatibility with SDL?

I'm linking the tcl 8.63 version and no I'm not using threads.
I tested removing the SDL part of the code and built it and there were no threading issues.
Maybe it is as you say an incompatibility with SDL

I'll try and think about this for a while
Thanks for the help sir.
November 04, 2014
On Monday, 3 November 2014 at 22:26:14 UTC, Jack wrote:
> I'll try and think about this for a while
> Thanks for the help sir.

No worries. I don't really know what else to suggest without seeing a little code. Do you have a simple full program that shows the error happening?
November 04, 2014
On Tuesday, 4 November 2014 at 08:30:34 UTC, Gary Willoughby
wrote:
> On Monday, 3 November 2014 at 22:26:14 UTC, Jack wrote:
>> I'll try and think about this for a while
>> Thanks for the help sir.
>
> No worries. I don't really know what else to suggest without seeing a little code. Do you have a simple full program that shows the error happening?

Here's the main file:
http://codepad.org/hu4r0ExB

and Here's the module:
http://codepad.org/ikXAzfdg

Dependencies are DerelictSDL and Tkd.

It's the most simple one I got that reproduces the error.
November 04, 2014
On 11/4/2014 7:34 PM, Jack wrote:
> On Tuesday, 4 November 2014 at 08:30:34 UTC, Gary Willoughby

>
> Here's the main file:
> http://codepad.org/hu4r0ExB
>
> and Here's the module:
> http://codepad.org/ikXAzfdg
>
> Dependencies are DerelictSDL and Tkd.
>
> It's the most simple one I got that reproduces the error.

You might start by adding a call to Mix_Init after SDL_Init and before calling any other Mix_* functions. SDL_Init doesn't know anything about the SDL_mixer library. See [1] for details (and don't forget the corresponding Mix_Quit [2]).

[1] https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_9.html
[2] https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_10.html#SEC10


November 04, 2014
On Tuesday, 4 November 2014 at 10:34:19 UTC, Jack wrote:
>> No worries. I don't really know what else to suggest without seeing a little code. Do you have a simple full program that shows the error happening?
>
> Here's the main file:
> http://codepad.org/hu4r0ExB
>
> and Here's the module:
> http://codepad.org/ikXAzfdg
>
> Dependencies are DerelictSDL and Tkd.
>
> It's the most simple one I got that reproduces the error.

Have you got a copy of the dub.json file you use?
November 04, 2014
On Tuesday, 4 November 2014 at 18:22:49 UTC, Gary Willoughby wrote:
> On Tuesday, 4 November 2014 at 10:34:19 UTC, Jack wrote:
>>> No worries. I don't really know what else to suggest without seeing a little code. Do you have a simple full program that shows the error happening?
>>
>> Here's the main file:
>> http://codepad.org/hu4r0ExB
>>
>> and Here's the module:
>> http://codepad.org/ikXAzfdg
>>
>> Dependencies are DerelictSDL and Tkd.
>>
>> It's the most simple one I got that reproduces the error.
>
> Have you got a copy of the dub.json file you use?

Ah, no matter, i've got all the libs installed and linking now.
« First   ‹ Prev
1 2