minttea icon indicating copy to clipboard operation
minttea copied to clipboard

unbound value receive_any ()

Open vincentaxhe opened this issue 1 year ago • 5 comments

I know little about ocaml, and just moved from go 'bubbletea', ocaml simple syntax attracted me. But I enter every example subfolder, and run 'dune bulid' always failed for same error

File "minttea/io_loop.ml", line 49, characters 10-21:
49 |   let _ = receive_any () in
               ^^^^^^^^^^^
Error: Unbound value receive_any

I have installed minttea and Leaves by opam, why can't build smoothly like go 'bubbletea' examples, give anyone who tries a bit sweet to taste first.

vincentaxhe avatar Oct 10 '24 13:10 vincentaxhe

I think receive_any got introduced in [email protected]. While the dune-project file references 0.0.9, minttea.opam references 0.0.8:

https://github.com/leostera/minttea/blob/aa5ef898f6ce4b2a5b359dd6f985cbe2a3583b70/dune-project#L22

https://github.com/leostera/minttea/blob/aa5ef898f6ce4b2a5b359dd6f985cbe2a3583b70/minttea.opam#L15

I got the "tutorial" code described in the readme compiling (which is also a temporary solution to #54):

  • pin to riot 0.0.9: opam pin add riot 0.0.9
  • pin to github main branch of minttea: opam pin add minttea [email protected]:leostera/minttea.git
  • pin edit minttea: change riot dependency to 0.0.9

woeps avatar Oct 17 '24 23:10 woeps

I git pull, no updates. then edit minttea/minttea.opam "riot" {= "0.0.8"}, and go to example/list, and run 'dune build', same error. then run opam pin add riot 0.0.9 sucessfully, and run dune build again,

Entering directory '/home/vincent/disk/Codes/Ocaml/minttea'
File "minttea/dune", line 4, characters 12-16:
4 |  (libraries riot tty))
                ^^^^
Error: Library "riot" not found.
-> required by library "minttea" in _build/default/minttea
-> required by executable main in examples/list/dune:2
-> required by _build/default/examples/list/main.exe
-> required by alias examples/list/all
-> required by alias examples/list/default

then run opam install riot, got

he following actions will be performed:
=== install 2 packages
  ∗ gluon 0.0.9          [required by riot]
  ∗ riot  0.0.9 (pinned)

Proceed with ∗ 2 installations? [y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved gluon.0.0.9  (cached)
[ERROR] The compilation of gluon.0.0.9 failed at "dune build -p gluon -j 7
        @install".

#=== ERROR while compiling gluon.0.0.9 ========================================#
# context     2.2.1 | linux/x86_64 | ocaml.5.2.0 | https://opam.ocaml.org#ac01ad6037c0bdcca9f67fe49cd54475b585f9b2
# path        ~/sdisk/Ocaml/opam/default/.opam-switch/build/gluon.0.0.9
# command     ~/sdisk/Ocaml/opam/opam-init/hooks/sandbox.sh build dune build -p gluon -j 7 @install
# exit-code   1
# env-file    ~/sdisk/Ocaml/opam/log/gluon-290934-66ab60.env
# output-file ~/sdisk/Ocaml/opam/log/gluon-290934-66ab60.out
### output ###
# File "gluon/sys/unix/dune", line 11, characters 41-57:
# 11 |   (names gluon_unix_io gluon_unix_kqueue gluon_unix_epoll)
#                                               ^^^^^^^^^^^^^^^^
# (cd _build/default/gluon/sys/unix && /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -g -fno-omit-frame-pointer -fPIC -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/ocaml/src=/usr/src/debug/ocaml[...]
# gluon_unix_epoll.c: 在函数‘gluon_unix_epoll_ctl’中:
# gluon_unix_epoll.c:73:20: 错误:assignment to ‘uint64_t’ {或称 ‘long unsigned int’} from ‘value *’ {或称 ‘long int *’} makes integer from pointer without a cast [-Wint-conversion]
#    73 |     event.data.u64 = ocaml_value;
#       |                    ^



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build gluon 0.0.9
└─
╶─ No changes have been performed

install failed. can not run opam pin add minttea [email protected]:leostera/minttea.git

vincentaxhe avatar Oct 17 '24 23:10 vincentaxhe

I'm not sure about this error. Are you using ocaml >= 5.1?

Check with ocaml --version or opam switch list.

woeps avatar Oct 18 '24 11:10 woeps

The OCaml toplevel, version 5.2.0 on Arch. If it's selfsustained will be better I think, though I know little about how ocaml works, but it give me an impression tui project written by ocaml is rough after I view some other projects in github. But for a tui infrastructure, examples can be compiled is not a high request.

vincentaxhe avatar Oct 18 '24 14:10 vincentaxhe

I attempted to fix the riot version bound in:

  • https://github.com/leostera/minttea/pull/59

But now I have a new unexpected error:

[ERROR] The compilation of minttea.dev failed at "dune build -p minttea -j 7 @install".

#=== ERROR while compiling minttea.dev ========================================#
# context     2.1.5 | linux/x86_64 | ocaml.5.2.1 | pinned(git+https://github.com/chshersh/minttea#20286772b1d0399f0af3374da3b6f62b1b00879a)
# path        ~/ocaml/github-tui/_opam/.opam-switch/build/minttea.dev
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p minttea -j 7 @install
# exit-code   1
# env-file    ~/.opam/log/minttea-41731-113f0f.env
# output-file ~/.opam/log/minttea-41731-113f0f.out
### output ###
# 112 |   let Config.{ render_mode; fps } = config in
# [...]
# Error: Unbound record field "fps"
# (cd _build/default && /home/chshersh/ocaml/github-tui/_opam/bin/ocamlc.opt -w -40 -g -bin-annot -bin-annot-occurrences -I minttea/.minttea.objs/byte -I /home/chshersh/ocaml/github-tui/_opam/lib/angstrom -I /home/chshersh/ocaml/github-tui/_opam/lib/asn1-combinators -I /home/chshersh/ocaml/github-tui/_opam/lib/base64 -I /home/chshersh/ocaml/github-tui/_opam/lib/bigstringaf -I /home/chshersh/oca[...]
# File "minttea/minttea.ml", line 8, characters 61-72:
# 8 | let config ?(render_mode = `clear) ?(fps = 60) () = Config.{ render_mode; fps }
#                                                                  ^^^^^^^^^^^
# Error: Unbound record field "render_mode"
# (cd _build/default && /home/chshersh/ocaml/github-tui/_opam/bin/ocamlopt.opt -w -40 -g -I minttea/.minttea.objs/byte -I minttea/.minttea.objs/native -I /home/chshersh/ocaml/github-tui/_opam/lib/angstrom -I /home/chshersh/ocaml/github-tui/_opam/lib/asn1-combinators -I /home/chshersh/ocaml/github-tui/_opam/lib/base64 -I /home/chshersh/ocaml/github-tui/_opam/lib/bigstringaf -I /home/chshersh/oca[...]
# File "minttea/renderer.ml", line 112, characters 28-31:
# 112 |   let Config.{ render_mode; fps } = config in
#                                   ^^^
# Error: Unbound record field "fps"

chshersh avatar Dec 22 '24 11:12 chshersh