Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure on gluon's kqueue stub with Big Sur (Apple SDK 11) #58

Open
huwaireb opened this issue Feb 13, 2024 · 3 comments · Fixed by #64
Open

Build failure on gluon's kqueue stub with Big Sur (Apple SDK 11) #58

huwaireb opened this issue Feb 13, 2024 · 3 comments · Fixed by #64

Comments

@huwaireb
Copy link

Problem

It seems like we're implicitly casting struct kevent * to const char * and that's a problem in older versions of the Apple SDK.

event_array = caml_alloc_array(kqueue_event_to_record, event_ptrs);

Screenshot 2024-02-13 at 23 53 45

Environment Info

Note

I'm not on Big Sur, I'm using Nix to build Riot which provides it's own Apple SDK, and it lacks Apple SDKs above 11.0 (can share flake if needed).
& Big Sur is only ~4 years old so I believe compatibility should be ensured.

SDK: 11,
Darwin: xnu-7195 sys/event.h

@stuckinforloop
Copy link

Reopening the issue because I'm facing this when installing Riot v0.0.8. Following are some logs which can help with debugging:

[ERROR] The compilation of gluon.0.0.8 failed at "dune build -p gluon -j 10 @install".

#=== ERROR while compiling gluon.0.0.8 ========================================#
# context     2.1.5 | macos/arm64 | ocaml.5.1.1 | https://opam.ocaml.org#4bb8cb8b
# path        ~/.opam/default/.opam-switch/build/gluon.0.0.8
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p gluon -j 10 @install
# exit-code   1
# env-file    ~/.opam/log/gluon-88181-9fbc4c.env
# output-file ~/.opam/log/gluon-88181-9fbc4c.out
### output ###
# gluon_unix_kqueue.c:73:36: error: incompatible function pointer types passing 'value (struct kevent *)' (aka 'long (struct kevent *)') to parameter of type 'value (*)(const char *)' (aka 'long (*)(const char *)') [-Wincompatible-function-pointer-types]
# [...]
#                                    ^~~~~~~~~~~~~~~~~~~~~~
# /Users/neel/.opam/default/lib/ocaml/caml/alloc.h:57:44: note: passing argument to parameter 'funct' here
# CAMLextern value caml_alloc_array (value (*funct) (char const *),
#                                            ^
# gluon_unix_kqueue.c:73:60: warning: incompatible pointer types passing 'struct kevent **' to parameter of type 'const char *const *' [-Wincompatible-pointer-types]
#     event_array = caml_alloc_array(kqueue_event_to_record, event_ptrs);
#                                                            ^~~~~~~~~~
# /Users/neel/.opam/default/lib/ocaml/caml/alloc.h:58:57: note: passing argument to parameter 'array' here
#                                    char const * const * array);
#                                                         ^

Other specifications:

  • macos 14.3.1 (Macbook M3 Pro)
  • target: arm64-apple-darwin23.3.0
  • gcc version: Apple clang version 15.0.0 (clang-1500.3.9.4)

@leostera leostera reopened this Mar 28, 2024
@huwaireb
Copy link
Author

huwaireb commented Mar 28, 2024

Hey @stuckinforloop,

The fix that landed in #64 didn't manage to land in time prior to the latest (0.0.8) release. See 0.0.8...main.

I'd suggest using riot from source as mentioned here (heads up, it might be a little tedious 😥).

It's weird why it broke on 14.3.1 considering it's the latest (cc @leostera a new release might be necessary)

we can re-close if this fixes your problem @stuckinforloop.

@stuckinforloop
Copy link

If I follow the same instructions as in CONTRIBUTING.md file, I'm getting the following issue:

Package conflict!
  * Missing dependency:
    - config >= 0.0.2
    not available because the package is pinned to version 0.0.1

If I remove the pin for config package and run add the remaining dependencies, I'm getting an error for dune build

[ERROR] The compilation of riot.0.0.8 failed at "dune build -p riot -j 10 @install".

#=== ERROR while compiling riot.0.0.8 =========================================#
# context     2.1.5 | macos/arm64 | ocaml.5.1.1 | pinned(git+https://github.com/riot-ml/riot#2d7386bf6e8adc934ba10e2fa24e711f6534af5f)
# path        ~/personal/touch-tui/_opam/.opam-switch/build/riot.0.0.8
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p riot -j 10 @install
# exit-code   1
# env-file    ~/.opam/log/riot-74185-334f9f.env
# output-file ~/.opam/log/riot-74185-334f9f.out
### output ###
# (cd _build/default && /Users/neel/personal/touch-tui/_opam/bin/ocamlc.opt -w -40 -g -bin-annot -I riot/lib/.lib.objs/byte -I /Users/neel/personal/touch-tui/_opam/lib/angstrom -I /Users/neel/personal/touch-tui/_opam/lib/asn1-combinators -I /Users/neel/personal/touch-tui/_opam/lib/base64 -I /Users/neel/personal/touch-tui/_opam/lib/bigstringaf -I /Users/neel/personal/touch-tui/_opam/lib/bytestri[...]
# File "riot/lib/ssl.ml", line 97, characters 11-47:
# 97 |       | Ok (state', `Response resp, `Data data) ->
#                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: This pattern matches values of type 'a * 'b * 'c
#        but a pattern was expected which matches values of type
#          Tls.Engine.state * [ `Eof ] option *
#          [ `Response of Cstruct.t option ] * [ `Data of Cstruct.t option ]

@leostera leostera removed this from the riot/phase-2 milestone Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants