turion / rhine

Haskell Functional Reactive Programming framework with type-level clocks
http://hackage.haskell.org/package/rhine
118 stars 21 forks source link

Gloss issue on mac in rhine-bayes executable #212

Open reubenharry opened 1 year ago

reubenharry commented 1 year ago

If I do cabal run rhine-bayes-gloss inside the rhine-bayes dir, I get:

2023-02-17 10:48:57.893 rhine-bayes-gloss[3506:11456461] GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: NSWindow drag regions should only be invalidated on the Main Thread!

I recognize this as a Gloss issue for Mac (see e.g. https://www.reddit.com/r/haskell/comments/f59opw/error_when_trying_to_use_gloss_package/) and tried removing threaded from the .cabal file, but the error persisted.

There should be a simple fix (since I am able to run gloss in rhine-bayes-examples), but I'm not sure exactly what.

turion commented 1 year ago

There should be a simple fix (since I am able to run gloss in rhine-bayes-examples), but I'm not sure exactly what.

Can you say which example succeeds?

Also, can you run rhine-gloss-gears from rhine-gloss? There are different choices them, can you try each one?

reubenharry commented 1 year ago

Both options for rhine-bayes-gloss fail. Option (3) for rhine-gloss-gears fails, but (1) and (2) succeed.

turion commented 1 year ago

Then I'm pretty certain that this is caused by forkIO. I think this is a known problem for MacOS + fork + OpenGL, but I don't know a solution. See e.g. https://github.com/turion/essence-of-live-coding-tutorial/issues/3

turion commented 1 year ago

Can you try the suggestion from https://github.com/turion/essence-of-live-coding-tutorial/issues/3#issuecomment-678754304 ?

reubenharry commented 1 year ago

This didn't work, although for option (3) of rhine-gloss-gears, it produces a different behavior (hanging, instead of crashing). For rhine-bayes-gloss, it still crashed for both (1) and (2).