garrigue / lablgtk

LablGTK 2 and 3: an interface to the GIMP Tool Kit
https://garrigue.github.io/lablgtk
Other
89 stars 40 forks source link

Lablgtk 3.1.4 fails to build with opam on macOS 14.4 #178

Closed davidnowak closed 3 months ago

davidnowak commented 4 months ago

A successful opam init followed by opam install lablgtk3 fails on macOS Sonoma 14.4:

#=== ERROR while compiling lablgtk3.3.1.4 =====================================#
# context     2.1.5 | macos/x86_64 | ocaml.5.1.1 | https://opam.ocaml.org#69e073a5
# path        ~/.opam/default/.opam-switch/build/lablgtk3.3.1.4
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p lablgtk3 -j 19
# exit-code   1
# env-file    ~/.opam/log/lablgtk3-26124-d6bcd6.env
# output-file ~/.opam/log/lablgtk3-26124-d6bcd6.out
### output ###
# 31 |    ml_gtk ml_gtkmisc
# [...]
# (cd _build/default/src && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -pthread -D_FILE_OFFSET_BITS=64 -I/usr/local/Cellar/gtk+3/3.24.41/include/gtk-3.0 -I/usr/local/Cellar/glib/2.80.0/include/gio-unix-2.0 -I/usr/local/Cellar/cairo/1.18.0/include -I/usr/local/Cellar/libepoxy/1.5.10/include -I/usr/local/Cellar/pango/1.52.1/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/8.3.0_1/include/harfbuzz[...]
# ml_gtk.c:236:78: error: incompatible function pointer types passing 'value (const char *)' (aka 'long (const char *)') to parameter of type 'value_in' (aka 'long (*)(void *)') [-Wincompatible-function-pointer-types]
# { return Val_GList(gtk_style_context_list_classes(GtkStyleContext_val(ctx)), Val_string); }
#                                                                              ^~~~~~~~~~
# ./wrappers.h:422:20: note: expanded from macro 'Val_string'
# #define Val_string copy_string_check
#                    ^~~~~~~~~~~~~~~~~
# ./ml_glib.h:30:50: note: passing argument to parameter here
# CAMLexport value Val_GList (GList *list, value_in);
#                                                  ^
# 1 error generated.

In case it is related to issue #177, the command gcc --version returns:

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
davidnowak commented 4 months ago

Workaround: opam pin lablgtk3 3.1.3

peterlefanulumsdaine commented 4 months ago

I’m having what seems like the probably the same issue — a build failure for lablgtk3 3.1.4 on macOS Sonoma 14.4, on a fairly clean system, with other opam packages building fine — but with different error details:

#=== ERROR while compiling lablgtk3.3.1.4 =====================================#
# context     2.1.5 | macos/arm64 | ocaml.5.1.1 | https://opam.ocaml.org#ac9a846c
# path        ~/.opam/default/.opam-switch/build/lablgtk3.3.1.4
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p lablgtk3 -j 11
# exit-code   1
# env-file    ~/.opam/log/lablgtk3-31404-a4c564.env
# output-file ~/.opam/log/lablgtk3-31404-a4c564.out
### output ###
# [...]
# #define GLIB_DEPRECATED_MACRO_IN_2_30_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
#                                              ^
# /opt/homebrew/Cellar/glib/2.80.0/include/glib-2.0/glib/gmacros.h:1300:3: note: expanded from macro 'GLIB_DEPRECATED_MACRO_FOR'
#   _GLIB_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Deprecated pre-processor symbol: replace with #f))
#   ^
# /opt/homebrew/Cellar/glib/2.80.0/include/glib-2.0/glib/gmacros.h:1297:33: note: expanded from macro '_GLIB_GNUC_DO_PRAGMA'
# #define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
#                                 ^
# <scratch space>:84:6: note: expanded from here
#  GCC warning "Deprecated pre-processor symbol: replace with \"const\""
#      ^
# 6 warnings generated.

My gcc --version returns almost exactly the same as @davidnowak gives above:

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Following @davidnowak ’s suggested workaround, lablgtk3.3.1.3 installs fine.

MSoegtropIMC commented 4 months ago

I can confirm both the issue with lablgtk3.3.1.4 and that falling back to lablgtk3.3.1.3 fixes this (in the Coq Platform context).

garrigue commented 3 months ago

Passing a function pointer without a cast seems to be a bad idea... Fixed; will also put the patch in opam before doing a new release.