Skip to content

raygui bindings broken #42

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

Closed
benjamin-branchware opened this issue May 19, 2024 · 2 comments
Closed

raygui bindings broken #42

benjamin-branchware opened this issue May 19, 2024 · 2 comments

Comments

@benjamin-branchware
Copy link

The raygui bindings seems either unmaintained or just broken:

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved raygui.0.6.0  (https://opam.ocaml.org/cache)
[ERROR] The compilation of raygui.0.6.0 failed at "dune build -p raygui -j 11 @install".

#=== ERROR while compiling raygui.0.6.0 =======================================#
# context     2.1.5 | linux/x86_64 | ocaml.5.1.1 | https://opam.ocaml.org#ec28f29e
# path        ~/.opam/default/.opam-switch/build/raygui.0.6.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p raygui -j 11 @install
# exit-code   1
# env-file    ~/.opam/log/raygui-40827-7d9e2c.env
# output-file ~/.opam/log/raygui-40827-7d9e2c.out
### output ###
# 164 |   (names c_generated_gui)
# [...]
# (cd _build/default/src/c && /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -g -I /home/<redacted>/.opam/default/lib/ocaml -I /home/<redacted>/.opam/default/lib/bigarray-compat -I /home/<redacted>/.opam/default/lib/ctypes -I /home/<redacted>/.opam/default/lib/ctypes/stubs -I /home/benja[...]
# c_generated_gui.c: In function ‘raygui_stub_37_GuiListViewEx’:
# c_generated_gui.c:378:35: error: passing argument 2 of ‘GuiListViewEx’ from incompatible pointer type [-Wincompatible-pointer-types]
#   378 |    int x405 = GuiListViewEx(x395, x396, x397, x400, x401, x402);
#       |                                   ^~~~
#       |                                   |
#       |                                   char **
# In file included from c_generated_gui.c:3:
# vendor/raygui/src/raygui.h:2724:50: note: expected ‘const char **’ but argument is of type ‘char **’
#  2724 | int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active)
#       |                                     ~~~~~~~~~~~~~^~~~



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build raygui 0.6.0
└─ 
╶─ No changes have been performed
@tjammer
Copy link
Owner

tjammer commented May 20, 2024

They're neither unmaintained nor just broken. The issue is that as of now, ocaml-ctypes does not support cv-qualifiers. Thus, strings in binding code are always char* instead of const char*, which leads to a warning (-Wincompatible-pointer-types). There is a issue in the ctypes repo, which goes back to 2014 (yallop/ocaml-ctypes#134).

Recently, gcc14 turned this warning into an error (see https://gcc.gnu.org/gcc-14/porting_to.html#warnings-as-errors). Am I correct in assuming that's the version you are on?

Unfortunately, I don't know how to work around this without explicit support for const in ctypes. In another issue, the author called the warning "unavoidable" (for now, fdopen/ppx_cstubs#6 (comment)).
Maybe we could patch raygui to change the declaration.. I'll see if this is feasible.

Until then, you could try to compile with an older version of gcc.

@tjammer
Copy link
Owner

tjammer commented May 20, 2024

Patching raygui seems to work. The last commit should build for you. I'll leave the issue open until I have published the fix on opam.

@tjammer tjammer closed this as completed May 22, 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

No branches or pull requests

2 participants