Fork me on GitHub
#membrane
<
2021-10-19
>
Dan Maltbie03:10:39

I tried running the membrane.example.todo/-main example and got the following error

Syntax error (UnsatisfiedLinkError) compiling at (membrane/skia.clj:582:5).
Error looking up function 'skia_font_metrics': /home/parallels/.cache/JNA/temp/jna502396494449745697.tmp: undefined symbol: skia_font_metrics
This was on branch 0.9.29.0-beta. The same code runs on branch 0.9.27.5-betabut the focus area for labels with :mouse-down event is extremely narrow and misaligned for rows below the first. Any suggestions for which version to use?

šŸ‘€ 1
phronmophobic03:10:57

Let me take a look. one sec.

šŸ™ 1
phronmophobic03:10:06

what skialib dependency are you using?

Dan Maltbie03:10:54

I'm running with lein

Dan Maltbie03:10:00

I look in the project.clj file for membrane 0.9.29.0-beta and it has

;; skia
[com.phronemophobic.membrane/skialib-macosx "0.9.27-beta"]
[com.phronemophobic.membrane/skialib-linux "0.9.27-beta"]

Dan Maltbie03:10:25

or is somewhere else?

phronmophobic03:10:36

those would need to be updated

Dan Maltbie03:10:54

got it. let me try it.

phronmophobic03:10:57

I switched over to the clojure cli at some point and haven't been keeping lein up to date

phronmophobic03:10:23

the dependency name has also changed to include the architecture (eg. aarch64, x86-64)

phronmophobic03:10:44

;; one of
[com.phronemophobic.membrane/skialib-macosx-x86-64 "0.9.29.0-beta"]
[com.phronemophobic.membrane/skialib-linux-x86-64 "0.9.29.0-beta"]
[com.phronemophobic.membrane/skialib-macosx-aarch64 "0.9.29.0-beta"]

phronmophobic04:10:02

you can just include all 3 and nothing bad will happen

šŸ‘ 1
phronmophobic04:10:05

> the focus area for labels with :mouse-down event is extremely narrow and misaligned for rows below the first. I'm not sure what is causing that. Do you have a screenshot? Which OS are you running?

Dan Maltbie04:10:49

got this error
Execution error (AssertionError) at membrane.skia/run-sync (skia.clj:1746).
Assert failed: Could not run because glfw could not be loaded.

Dan Maltbie04:10:17

## java -version

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
## lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename: focal ## uname -a
Linux parallels 5.11.0-37-generic #41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
## Parallels
17.0.1 Pro Edition

Dan Maltbie04:10:08

project.clj has

[org.lwjgl/lwjgl "3.2.3"]
[org.lwjgl/lwjgl "3.2.3" :classifier "natives-macos"]
[org.lwjgl/lwjgl-glfw "3.2.3"]
[org.lwjgl/lwjgl-glfw "3.2.3"  :classifier "natives-macos"]
[org.lwjgl/lwjgl-opengl "3.2.3"]
[org.lwjgl/lwjgl-opengl "3.2.3"  :classifier "natives-macos"]]}}

phronmophobic04:10:05

yea, I'm seeing the same error when I run with lein as well

phronmophobic04:10:30

hmm, it might actually be particular skialib version. It's the first version I uploaded via github CI šŸ˜³

Dan Maltbie04:10:50

I've got to crash for the night, but I'm happy to run more tests tomorrow if that would be of help.

phronmophobic04:10:22

ah. I see the issue. I forgot to include glfw

šŸ˜‹ 1
phronmophobic04:10:48

Sorry about that. I'll fix that tonight. Have a good night. Thanks for giving it a shot.

Dan Maltbie04:10:48

I really want to use your library, so willing to put in some extra to get it to work. --later.

šŸ™ 1
phronmophobic04:10:32

I think it should work now.

Dan Maltbie20:10:53

error in process sentinel: Could not start nREPL server: Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in central (https://repo1.maven.org/maven2/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in clojars (https://repo.clojars.org/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in sonatype-oss-public (https://oss.sonatype.org/content/groups/public/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-x86-64:jar:0.9.29.1-beta in space-maven (https://packages.jetbrains.team/maven/p/skija/maven) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in central (https://repo1.maven.org/maven2/) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in clojars (https://repo.clojars.org/) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in sonatype-oss-public (https://oss.sonatype.org/content/groups/public/) Could not find artifact com.phronemophobic.membrane:skialib-linux-x86-64:jar:0.9.29.1-beta in space-maven (https://packages.jetbrains.team/maven/p/skija/maven) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in central (https://repo1.maven.org/maven2/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in clojars (https://repo.clojars.org/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in sonatype-oss-public (https://oss.sonatype.org/content/groups/public/) Could not find artifact com.phronemophobic.membrane:skialib-macosx-aarch64:jar:0.9.29.1-beta in space-maven (https://packages.jetbrains.team/maven/p/skija/maven) This could be due to a typo in :dependencies, file system permissions, or network issues. If you are behind a proxy, try setting the 'http_proxy' environment variable.

phronmophobic20:10:35

did you pull the latest? It should be referring to 0.9.30.0

Dan Maltbie21:10:10

(defproject com.phronemophobic/membrane "0.9.30.0-beta"

phronmophobic21:10:35

are you on git commit 7ece0c6717ad1e535804e94bd1b13c5320dd3f5a?

Dan Maltbie21:10:41

:repositories {"sonatype-oss-public" ""
                  "space-maven" ""}

Dan Maltbie21:10:09

not sure. This is what magit is showing for history:

7adcc2a * v0.9.30.0 release-1357578724 v0.9.30.0 Bumping version.
3c3087e * updating lein deps.
00bafb6 * adding glfw libs to skialib projects.
e33a678 * Bump version.
cd53c6b * fix images on java2d.

phronmophobic21:10:31

yea, that's one commit behind

Dan Maltbie21:10:07

7ece0c6 * master membrane/master Updating lein skialib dependency version.

Dan Maltbie21:10:48

Ok. Now I can get examples.todo/-main to display the window but I'm still seeing that the focus point is not congruent with the element (e.g., need to :mouse-down well above the checkbox).

phronmophobic21:10:34

do you have a screenshot?

phronmophobic21:10:20

I'm struggling to come up with a theory for why that might happen

Dan Maltbie21:10:01

need to :mouse-down at exactly where the arrow-head points to change the checkbox for first

phronmophobic21:10:33

are all the hitboxes messed up or just the checkboxes?

Dan Maltbie21:10:14

All boxes. the first row button and textbox seem to work fine. It's as if all of the elements are starting from [0,n] instead of their top-left corner. I can try some of the other examples and see if I find a difference.

šŸ‘ 1
Dan Maltbie07:10:24

I am able to get example.todo to work but am seeing this error when I try other examples. Requires restart of the REPL to get todo to work again. I built a fresh Linux VM to try this test (ubuntu 20.04 + emacs + lein) and membrane master branch.

  Show: Project-Only All 
  Hide: Clojure Java REPL Tooling Duplicates  (13 frames hidden)

1. Unhandled java.lang.IllegalArgumentException
   No implementation of method: :put! of protocol:
   #'clojure.core.async.impl.protocols/WritePort found for class:
   clojure.core.async.impl.channels.ManyToManyChannel

          core_deftype.clj:  583  clojure.core/-cache-protocol-fn
          core_deftype.clj:  575  clojure.core/-cache-protocol-fn
             protocols.clj:   18  clojure.core.async.impl.protocols/eval24227/fn/G
                 async.clj:  143  clojure.core.async/>!!
                 async.clj:  138  clojure.core.async/>!!
                  skia.clj: 1749  membrane.skia/run-sync
                  skia.clj: 1706  membrane.skia/run-sync
                  skia.clj: 1740  membrane.skia/run-sync
                  skia.clj: 1706  membrane.skia/run-sync
          kitchen_sink.clj:  348  membrane.example.kitchen-sink/-main
          kitchen_sink.clj:  347  membrane.example.kitchen-sink/-main
               RestFn.java:  397  clojure.lang.RestFn/invoke
                      REPL:   53  membrane.example.kitchen-sink/eval51126
                      REPL:   53  membrane.example.kitchen-sink/eval51126
             Compiler.java: 7177  clojure.lang.Compiler/eval
             Compiler.java: 7132  clojure.lang.Compiler/eval
                  core.clj: 3216  clojure.core/eval
                  core.clj: 3212  clojure.core/eval
    interruptible_eval.clj:   82  nrepl.middleware.interruptible-eval/evaluate/fn/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  665  clojure.core/apply
                  core.clj: 1975  clojure.core/with-bindings*
                  core.clj: 1975  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   82  nrepl.middleware.interruptible-eval/evaluate/fn
                  main.clj:  437  clojure.main/repl/read-eval-print/fn
                  main.clj:  437  clojure.main/repl/read-eval-print
                  main.clj:  458  clojure.main/repl/fn
                  main.clj:  458  clojure.main/repl
                  main.clj:  368  clojure.main/repl
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   79  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   56  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  145  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  202  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  201  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  829  java.lang.Thread/run

Dan Maltbie07:10:00

Also, when I load an example into REPL, there is a long delay (15 seconds) with spinning busy wheel cursor.

phronmophobic07:10:59

that error seems pretty bizarre. how are you running the example?

phronmophobic07:10:37

The kitchen sink example uses the same function ( membrane.skia/run-sync) to start the UI as the todo example

phronmophobic07:10:48

for example, lein run -m membrane.example.kitchen-sink

Dan Maltbie17:10:36

my results from running this command

lein run -m membrane.example.kitchen-sink |& tee -a stack-trace
## textarea ok ## button ok ## scrollview FAIL {crash on select} - stack-trace: testing/scrollview-fail-1
Oct 20, 2021 10:09:54 AM com.sun.jna.Native$1 uncaughtException
   WARNING: JNA: Callback [email protected] threw the following exception
   java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## textarea-light ok ## checkbox ok ## image FAIL {crash on select} - stack-trace: testing/image-fail-1
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## label-using-default-font ok ## label-using-specified-font FAIL {font Menlo.tcc missing} ## label-using-specified-font-color ok ## label-using-default-font-change-size ok ## layout-vertical FAIL {checkbox does not respond to :mouse-down} ## rectangle-stroked ok ## rectangle-specified-color ok ## rectangle ok ## rectangle-rounded-stroke ok ## rectangle-rounded-specified-color ok ## scissor-view FAIL {crash on select} - stack-trace: testing/scissor-view-fail-1
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## with-image-scaling FAIL {crash on select}
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
## with-stroke
## with-stroke FAIL {crash on select}
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so

phronmophobic17:10:05

> layout-vertical That example isn't supposed to respond to events

āœ… 1
phronmophobic17:10:55

it seems weird that it would attempt to load libawt_xawt.so

phronmophobic17:10:40

is there more to the stack trace?

phronmophobic17:10:37

sometimes it creates a log that looks like hs_err_pid36675.log

Dan Maltbie20:10:04

I saved the stacktrace. Didn't want to clog the slack channel with it. I will post a link to it shortly.

phronmophobic19:10:10

It's asking me to request access.

phronmophobic19:10:45

:thumbsup: . Ok cool. I see the problem now

phronmophobic19:10:21

šŸ™ Thanks!

šŸ˜ 1
phronmophobic22:10:35

ok, just pushed a new commit, 5475620, that shouldn't crash on any of the image related examples: ā€¢ scissor-view ā€¢ with-image-scaling ā€¢ image ā€¢ scrollview I'm still not sure why with-stroke would crash and I couldn't find the stack trace for that one. The label-with-specified-font still won't work. I have some general label fixes planned and I'll fix that at the same time. You can still pass the path to a font file to use a different font, but Menlo.ttc won't exist on linux. I'm still not sure why checkboxes would have nonsensical hitboxes.

Dan Maltbie23:10:39

Thanks for the update!! I'll give it a spin later tonight.

Dan Maltbie13:10:59

Test Results

# lein run -m membrane.example.kitchen-sink |& tee -a output.txt

## Common for all tests
*FAIL cursor focus geometry is off for all elements.
 The y-position is about 10 points too short (appears above area of interest).
 The x-position seems correct.
!no exception failures on any of the tests.
*anomaly in font size change

## textarea
ok
## button
ok
## scrollview
!ok
## textarea-light
ok
## checkbox
ok
## image
!ok
## label-using-default-font
ok
## label-using-specified-font
!ok
## label-using-specified-font-color
ok
## label-using-default-font-change-size
ok? font size didn't change
## layout-vertical
!ok (works as expected)
## rectangle-stroked
ok
## rectangle-specified-color
ok
## rectangle
ok
## rectangle-rounded-stroke
ok
## rectangle-rounded-specified-color
ok
## scissor-view
!ok
## with-image-scaling
!ok
## with-stroke
!ok

Dan Maltbie13:10:16

Not sure how to isolate the focus point mis-alignment issue. Any suggestions? Build VM with minimal config? Other tests? Observe state with REPL?

phronmophobic20:10:28

Yea, the best way to debug would be to observe the state with repl. If you I could reproduce it locally, it wouldn't be too hard to figure out the issue with a few simple tests. It's a little more difficult trying to isolate the issue from afar

Dan Maltbie22:10:21

How can I observe the position of the focus point from repl? Is this in skia or somewhere else?

phronmophobic22:10:39

what do you mean by focus point? Is that the component that is accepting key presses or something else?

Dan Maltbie00:10:53

where the mouse arrow is pointing [x, y]

phronmophobic01:10:38

It kinda depends on what you're trying to do. You can wrap your component in a :mouse-move event handler. For example:

(defn wrap-mouse-move [elem]
  ;; wrap to pass mouse-move events on to child components
  (ui/wrap-on
   :mouse-move
   (fn [handler pos]
     (prn "move: " pos)
     (handler pos))
   [;; mouse move only fires when on top of component
    ;; artifically make the component bigger
    (ui/spacer 600 600)
    elem]))
;; usage
(backend/run
  (constantly
   (wrap-mouse-move (ui/label "hi"))))

Dan Maltbie01:10:12

Thanks! I'll try this out and see what it says.

phronmophobic03:10:51

I split up the dependency on skia+glfw since not everyone will want to use the skia backend, but I haven't updated the docs yet to reflect that dependency change

phronmophobic03:10:29

you'll need one of: ā€¢ com.phronemophobic.membrane/skialib-linux-x86-64 {:mvn/version "0.9.29.0-beta"} ā€¢ com.phronemophobic.membrane/skialib-macosx-aarch64 {:mvn/version "0.9.29.0-beta"} ā€¢ com.phronemophobic.membrane/skialib-macosx-x86-64 {:mvn/version "0.9.29.0-beta"}

phronmophobic03:10:14

are you running the code via the clojure cli or lein?