membrane

https://github.com/phronmophobic/membrane
euccastro 2020-11-17T08:29:39.006200Z

I'm trying to follow the tutorial in Ubuntu 20.04 with Java 11 and (skia/run #(ui/label "Hello world!")) exits immediately without popping up anything or throwing/displaying any error. the call evaluates to #object[clojure.core.async.impl.channels.ManyToManyChannel 0x2c203f38 "clojure.core.async.impl.channels.ManyToManyChannel@2c203f38"]

euccastro 2020-11-17T08:33:52.006700Z

I tried to clojure.core.async/take! from that channel and my callback never gets called

phronmophobic 2020-11-17T08:51:47.007200Z

hmmm, it seems like it should display an error if nothing happens

phronmophobic 2020-11-17T08:52:19.007800Z

can you try using run-sync instead of run? (skia/run-sync #(ui/label "Hello world!"))

phronmophobic 2020-11-17T08:52:47.008300Z

just to double check, which version of membrane are you using?

phronmophobic 2020-11-17T08:57:37.008400Z

the channel should close when the all the windows are closed

euccastro 2020-11-17T09:17:40.008900Z

run-sync gives me an error trying to load a font:

Nov 17, 2020 10:16:30 AM com.sun.jna.Native$1 uncaughtException
WARNING: JNA: Callback membrane.skia.WindowRefreshCallback@51645204 threw the following exception
java.lang.AssertionError: Assert failed: unable to load font:  14
font-ptr
	at membrane.skia$load_font.invokeStatic(skia.clj:946)
	at membrane.skia$load_font.invoke(skia.clj:942)
	at membrane.skia$get_font.invokeStatic(skia.clj:407)
	at membrane.skia$get_font.invoke(skia.clj:389)
	at membrane.skia.LabelRaw._bounds(skia.clj:430)
	at membrane.ui$fn__10050.invokeStatic(ui.cljc:263)
	at membrane.ui$fn__10050.invoke(ui.cljc:263)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.core$memoize$fn__6877.doInvoke(core.clj:6353)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at membrane.skia$cached_draw.invokeStatic(skia.clj:964)
	at membrane.skia$cached_draw.invoke(skia.clj:954)
	at membrane.skia.Cached.draw(skia.clj:1001)
	at membrane.skia$eval12458$fn__12464.invoke(skia.clj:451)
	at membrane.skia$eval12188$fn__12189$G__12179__12194.invoke(skia.clj:87)
	at membrane.skia.GlfwSkiaWindow$fn__13145.invoke(skia.clj:1564)
	at membrane.skia.GlfwSkiaWindow.repaint_BANG_(skia.clj:1553)
	at membrane.skia$_window_refresh_callback.invokeStatic(skia.clj:1111)
	at membrane.skia$_window_refresh_callback.invoke(skia.clj:1110)
	at membrane.skia.WindowRefreshCallback$fn__12946.invoke(skia.clj:1124)
	at membrane.skia.WindowRefreshCallback.callback(skia.clj:1120)
	at com.sun.jna.Native.invokeVoid(Native Method)
	at com.sun.jna.Function.invoke(Function.java:414)
	at com.sun.jna.Function.invoke(Function.java:360)
	at com.sun.jna.Function.invoke(Function.java:314)
	at com.sun.jna.Function.invoke(Function.java:305)
	at membrane.skia$run_helper$wait__13198.invoke(skia.clj:1689)
	at membrane.skia$run_helper.invokeStatic(skia.clj:1708)
	at membrane.skia$run_helper.invoke(skia.clj:1671)
	at membrane.skia$run_sync$fn__13186.invoke(skia.clj:1621)
	at membrane.skia$dispatch_sync_BANG_$fn__12705.invoke(skia.clj:799)
	at membrane.skia$dispatch_sync_BANG_.invokeStatic(skia.clj:791)
	at membrane.skia$dispatch_sync_BANG_.invoke(skia.clj:790)
	at membrane.skia$run_sync.invokeStatic(skia.clj:1618)
	at membrane.skia$run_sync.invoke(skia.clj:1571)
	at membrane.skia$run_sync.invokeStatic(skia.clj:1605)
	at membrane.skia$run_sync.invoke(skia.clj:1571)
	at prova$run.invokeStatic(prova.clj:21)
	at prova$run.invoke(prova.clj:19)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.core$apply.invoke(core.clj:660)
	at clojure.run.exec$exec.invokeStatic(exec.clj:37)
	at clojure.run.exec$exec.doInvoke(exec.clj:32)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at clojure.run.exec$_main.invokeStatic(exec.clj:147)
	at clojure.run.exec$_main.doInvoke(exec.clj:137)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.main$main_opt.invokeStatic(main.clj:514)
	at clojure.main$main_opt.invoke(main.clj:510)
	at clojure.main$main.invokeStatic(main.clj:664)
	at clojure.main$main.doInvoke(main.clj:616)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.main.main(main.java:40)

Execution error (AssertionError) at membrane.skia/load-font (skia.clj:946).
Assert failed: unable to load font:  14
font-ptr

euccastro 2020-11-17T09:18:30.009300Z

I'm using the version indicated in the tutorial: com.phronemophobic/membrane {:mvn/version "0.9.14-beta"}

phronmophobic 2020-11-17T09:20:44.010100Z

ah ok. I'm seeing the same error. I think the issue is that I just forgot to update the linux build for this version. i'm rebuilding right now!

euccastro 2020-11-17T09:21:20.010500Z

thank you! I'll give it a try as soon as it's rebuilt

šŸŽ‰ 1
phronmophobic 2020-11-17T09:29:09.010800Z

ok, just uploaded [com.phronemophobic/membrane "0.9.15-beta"]

phronmophobic 2020-11-17T09:30:35.012Z

which doesn't appear to throw the same error on my ubuntu vm. (it's using a different version, but it's hopefully close enough šŸ¤ž)

euccastro 2020-11-17T09:42:27.013100Z

it works now, thanks! for some reason I can't run this with cider-jack-in, but if it works when launching from a terminal I guess I can cider-connect

phronmophobic 2020-11-20T03:13:54.022800Z

ok, I was finally able to investigate no window appearing when using cider-jack-in but I'm unable to reproduce

phronmophobic 2020-11-20T03:14:48.023200Z

@euccastro, can you share a few more details about your setup? how are you running emacs?

euccastro 2020-11-20T03:29:45.023400Z

I'm running spacemacs develop. cider-version gives me CIDER 1.0.0snapshot (package: <tel:202010201058|20201020.1058>), which seems odd

phronmophobic 2020-11-20T03:32:00.024200Z

are you running emacs in the terminal, or the emacs app?

euccastro 2020-11-20T03:32:19.024400Z

emacs app

phronmophobic 2020-11-20T03:34:16.026500Z

ok, iā€™m not sure how much that should matter since i think cider jack in starts a new process. iā€™m using java 8 to test on linux. let me upgrade to java 11 and try that

euccastro 2020-11-20T03:38:19.026700Z

I have to go to sleep now, but tomorrow I'll actually try this with a cider-connected nREPL, which I haven't done yet. I just launched a minimal test program with clojure and that worked

šŸ‘ 1
euccastro 2020-11-21T05:58:44.027Z

ha, I couldn't reproduce it in my desktop computer, which is running the same Ubuntu and cider version. I'm not with my laptop atm, but this may be more of an obscure corner case than it seemed..

euccastro 2020-11-21T05:59:24.027200Z

some cider middleware has different versions for some reason, but the latest is the one that works

phronmophobic 2020-11-17T09:43:04.013500Z

does it just hang when you use cider jack in? or is there an error?

euccastro 2020-11-17T09:43:15.013700Z

run-sync hangs

phronmophobic 2020-11-17T09:43:27.014100Z

it should hang until the window is closed

euccastro 2020-11-17T09:43:34.014500Z

run returns the channel and nothing else happens

euccastro 2020-11-17T09:43:41.014700Z

no window opens in either case

euccastro 2020-11-17T09:43:50.015100Z

but if I run it from the terminal I do get a window

euccastro 2020-11-17T09:45:35.017300Z

well, that's with run-sync. if I call run from the terminal I get no window (or maybe it gets created but the program exits before it gets a chance to show up)

phronmophobic 2020-11-17T09:45:36.017400Z

ok. that's a bummer. I'll write up an issue so I can make sure to look into it

euccastro 2020-11-17T09:50:07.019100Z

now, if I wait on a promise that gets delivered when the channel that run return closes, I do get a window

phronmophobic 2020-11-17T09:50:28.019300Z

I've filed the issue at https://github.com/phronmophobic/membrane/issues/6 if you find any other info.

phronmophobic 2020-11-17T10:05:03.021200Z

it's getting pretty late here, but if you run into any issues or goofiness, I'm absolutely looking for feedback. I'll try to look into the cider-jack-in issue tomorrow.

1