Gloss seems to crash on macOS?

124 views
Skip to first unread message

man...@enigmage.de

unread,
Aug 20, 2020, 8:26:12 PM8/20/20
to Haskell Gloss
Hi,

I'm trying to get a Gloss application to run on macOS. Not being a macOS user myself, this is quite a tedious process. I'm presenting it on Sunday at ICFP as a tutorial, and I expect macOS users to join the tutorial, so I'd like them to give something they can work on.

When I tested with a friend using macOS, we got the error "GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: nextEventMatchingMask should only be called from the Main Thread!". You can see the whole issue here: https://github.com/turion/essence-of-live-coding-tutorial/issues/3 I'm happy about help there.

My first try, inspired by https://stackoverflow.com/questions/45197922/glut-fatal-error-when-using-haskell-graphics-gloss, was that maybe the problem is that I'm using forkIO in places where I should use forkOS instead. But maybe that is unrelated?

Also, we were using nix for dependency management. I don't know whether that's a problem.

Do you know about this error? What is the issue, or what have I likely done wrong?
It would be greatly appreciated if anyone who is knowledgeable on this can help me. On https://github.com/turion/essence-of-live-coding-tutorial/, you can try it out.

Thanks, Manuel

Ben Lippmeier

unread,
Aug 20, 2020, 8:35:41 PM8/20/20
to haskel...@googlegroups.com, man...@enigmage.de
Do the gloss-examples work the same machine?

I am on OSX 10.14.6 and the gloss-examples work fine for me.

If the gloss-examples work, but you are still seeing the above error, then I would guess that you’re not supposed to start the GLUT main loop (via gloss play or some such) from a thread that is not the main one. The API call nextEventMatchingMask looks like a standard one from the OSX API https://developer.apple.com/documentation/appkit/nsapplication/1428485-nexteventmatchingmask. I don’t now much about the internals of GLUT or OSX event handling myself.


Ben.





Thomas DuBuisson

unread,
Aug 20, 2020, 8:45:55 PM8/20/20
to haskel...@googlegroups.com, man...@enigmage.de
I know gloss works on OS-X as I just dusted off an old marbles solver, rendered in gloss, last week and it worked fine on my rather modern mac book.

It is usually necessary for me to use `-fglfw` such as `cabal build -fglfw`.   In this case after brew installing pulseaudio I see a crash and:

```
EventResize (600,800)
W: [] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabilities support.
Assertion 'p' failed at pulse/simple.c:273, function int pa_simple_write(pa_simple *, const void *, size_t, int *)(). Aborting.
zsh: abort
```

--
You received this message because you are subscribed to the Google Groups "Haskell Gloss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-glos...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-gloss/C253E7BB-2FEE-4BE7-A0B8-DDC211415E41%40ouroborus.net.

Thomas DuBuisson

unread,
Aug 20, 2020, 8:49:20 PM8/20/20
to haskel...@googlegroups.com, man...@enigmage.de
Sorry that last bit was a bit vague.  I mean to say I installed pulse audio with homebrew, then built the essence-of-live-coding-tutorial via `cabal build -fglfw`, then executed the binary and was presented with the fault that was posted.

Thomas DuBuisson

unread,
Aug 20, 2020, 8:53:24 PM8/20/20
to haskel...@googlegroups.com, man...@enigmage.de
Heh, I guess I'm treating this more like IRC. Anyway...

It worked fine when I commented out the pulseaudio stuff - I received a ball on a windowed screen which accelerated in the direction of the mouse when I clicked and the impulse seemed to grow proportionally with the distance between the circle and the cursor.

Manuel Bärenz

unread,
Aug 22, 2020, 7:35:40 PM8/22/20
to haskel...@googlegroups.com

> built the essence-of-live-coding-tutorial via `cabal build -fglfw`,
> then executed the binary
Further clarification. I'm trying to run this in a cabal repl (it's a
livecoding project) and it seems like there the flags don't get passed,
even though they are in cabal.project.local.

Manuel Bärenz

unread,
Aug 22, 2020, 7:35:40 PM8/22/20
to haskel...@googlegroups.com

Dear Thomas, Ben,

Thanks for your answers! We've tried and replicate your solution, so far to no avail, but we're getting closer.

built the essence-of-live-coding-tutorial via `cabal build -fglfw`

What would the appropriate command be for a cabal repl? When doing `cabal repl -fglfw`, we still get GLUT errors, see https://github.com/turion/essence-of-live-coding-tutorial/issues/3#issuecomment-678309110. Probably the issue is that the flag isn't passed on to the appropriate package. My next try would be cabal configure --constraint 'gloss glfw' && cabal repl. (But since I don't have a mac, testing takes long.)

I'm happy about any other advice on how to get these flags right.

Best regards, Manuel

man...@enigmage.de

unread,
Aug 22, 2020, 7:35:57 PM8/22/20
to Haskell Gloss
I'm just realising that my answers didn't reach the list apparently. I replied by email, but that functionality seems to be broken.

It seems that I don't know how to activate the flag. In particular, I need to have the flag working in a `cabal repl`, not only in `cabal run`. (See also https://github.com/turion/essence-of-live-coding-tutorial/issues/3 for our attempts so far.)

Even when trying to start with `cabal repl -- constraint="gloss +glfw -glut"`, it still doesn't select the glfw backend.

It sort of seems to work with cabal run though, but I'm not entirely sure. Is there a way to check within Gloss which backend was chosen? All the Internal.Backend modules aren't exported, so I can't inspect the types there.

Manuel

Ben Lippmeier

unread,
Aug 22, 2020, 7:37:49 PM8/22/20
to haskel...@googlegroups.com, man...@enigmage.de


> On 22 Aug 2020, at 11:15 pm, man...@enigmage.de <man...@enigmage.de> wrote:
>
> I'm just realising that my answers didn't reach the list apparently. I replied by email, but that functionality seems to be broken.

It was just the google groups moderation queue. Messages from authors that haven’t posted before get put in a queue, and I need to manually bump them. Should be fine now.

Ben.

Reply all
Reply to author
Forward
0 new messages