Hi,
I am following up on the previously described issue of menu items not working on macOS, with which lb90 game me some help (for which I am greatful). It seems to me that the best way I could get more information is compile GTK4 myself.
Using homebrew as a base and Homebrew gtk4.rb
as a guide:
meson setup --prefix=$HOME/gtk4 \
--warnlevel 0 \
-Dgtk_doc=false \
-Dman-pages=true \
-Dintrospection=enabled \
-Dbuild-examples=false \
-Dbuild-tests=false \
-Dmedia-gstreamer=disabled \
-Dx11-backend=false \
-Dmacos-backend=true \
../gtk-4.11.4
Homebrew’s gtk4.rb
:
meson seems to complete without error, however ninja quickly runs into a problem:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:15:2: warning: gl.h and gl3.h are both included. Compiler will not invoke errors if using removed OpenGL functionality. [-W#warnings]
#warning gl.h and gl3.h are both included. Compiler will not invoke errors if using removed OpenGL functionality.
^
../gtk-4.11.4/gdk/macos/gdkmacosdisplay.c:1008:37: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
_gdk_macos_display_get_last_nsevent ()
^
void
2 warnings generated.
[43/1437] Compiling C object gdk/macos/libgdk-macos.a.p/gdkmacosglcontext.c.o
FAILED: gdk/macos/libgdk-macos.a.p/gdkmacosglcontext.c.o
cc -Igdk/macos/libgdk-macos.a.p -Igdk/macos -I../gtk-4.11.4/gdk/macos -I. -I../gtk-4.11.4 -Igdk -I../gtk-4.11.4/gdk -I/usr/local/Cellar/gdk-pixbuf/2.42.10_1/include/gdk-pixbuf-2.0 -I/usr/local/opt/libpng/include/libpng16 -I/usr/local/Cellar/libtiff/4.5.1/include -I/usr/local/Cellar/zstd/1.5.5/include -I/usr/local/Cellar/xz/5.4.3/include -I/usr/local/Cellar/jpeg-turbo/3.0.0/include -I/usr/local/Cellar/glib/2.76.4/include -I/usr/local/Cellar/glib/2.76.4/include/glib-2.0 -I/usr/local/Cellar/glib/2.76.4/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre2/10.42/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/ffi -I/usr/local/Cellar/cairo/1.16.0_5/include/cairo -I/usr/local/Cellar/pixman/0.42.2/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.14.2/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libxcb/1.15_1/include -I/usr/local/Cellar/libxrender/0.9.11/include -I/usr/local/Cellar/libxext/1.3.5/include -I/usr/local/Cellar/libx11/1.8.6/include -I/usr/local/Cellar/libxau/1.0.11/include -I/usr/local/Cellar/libxdmcp/1.1.4/include -I/usr/local/Cellar/xorgproto/2023.2/include -I/usr/local/Cellar/pango/1.50.14/include/pango-1.0 -I/usr/local/Cellar/fribidi/1.0.13/include/fribidi -I/usr/local/Cellar/harfbuzz/8.0.1/include/harfbuzz -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/graphene/1.10.8/include/graphene-1.0 -I/usr/local/Cellar/graphene/1.10.8/lib/graphene-1.0/include -I/usr/local/Cellar/libepoxy/1.5.10/include -I/usr/local/Cellar/glib/2.76.4/include/gio-unix-2.0 -fcolor-diagnostics -std=gnu99 -O2 -g -DG_LOG_USE_STRUCTURED=1 -DGLIB_DISABLE_DEPRECATION_WARNINGS '-DGTK_VERSION="4.11.4"' -D_GNU_SOURCE -DG_ENABLE_DEBUG -mfpmath=sse -msse -msse2 -DGTK_COMPILATION '-DG_LOG_DOMAIN="Gdk"' -xobjective-c -fno-strict-aliasing -Wno-c++11-extensions -Wno-missing-include-dirs -Wno-typedef-redefinition -Wno-tautological-constant-out-of-range-compare -Wformat=2 -Wformat-nonliteral -Wformat-security -Wignored-qualifiers -Wimplicit-function-declaration -Wmisleading-indentation -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wuninitialized -Wunused -Werror=address -Werror=array-bounds -Werror=empty-body -Werror=implicit -Werror=implicit-fallthrough -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=missing-declarations -Werror=missing-prototypes -Werror=nonnull -Werror=pointer-to-int-cast -Werror=redundant-decls -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=vla -Werror=write-strings -Wnull-dereference -MD -MQ gdk/macos/libgdk-macos.a.p/gdkmacosglcontext.c.o -MF gdk/macos/libgdk-macos.a.p/gdkmacosglcontext.c.o.d -o gdk/macos/libgdk-macos.a.p/gdkmacosglcontext.c.o -c ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c:29:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:23:
In file included from ../gtk-4.11.4/gdk/gdkglcontextprivate.h:24:
In file included from ../gtk-4.11.4/gdk/gdkdrawcontextprivate.h:25:
In file included from ../gtk-4.11.4/gdk/gdkmemoryformatprivate.h:24:
/usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl.h:53:9: warning: 'GLAPI' macro redefined [-Wmacro-redefined]
#define GLAPI
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:106:9: note: previous definition is here
#define GLAPI extern
^
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c:29:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:23:
In file included from ../gtk-4.11.4/gdk/gdkglcontextprivate.h:24:
In file included from ../gtk-4.11.4/gdk/gdkdrawcontextprivate.h:25:
In file included from ../gtk-4.11.4/gdk/gdkmemoryformatprivate.h:24:
In file included from /usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl.h:89:
/usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl_generated.h:975:9: warning: 'GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT' macro redefined [-Wmacro-redefined]
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:631:9: note: previous definition is here
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
^
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c:29:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:23:
In file included from ../gtk-4.11.4/gdk/gdkglcontextprivate.h:24:
In file included from ../gtk-4.11.4/gdk/gdkdrawcontextprivate.h:25:
In file included from ../gtk-4.11.4/gdk/gdkmemoryformatprivate.h:24:
In file included from /usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl.h:89:
/usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl_generated.h:4947:9: warning: 'GL_DRAW_FRAMEBUFFER_BINDING' macro redefined [-Wmacro-redefined]
#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:1174:9: note: previous definition is here
#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
^
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c:29:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:23:
In file included from ../gtk-4.11.4/gdk/gdkglcontextprivate.h:24:
In file included from ../gtk-4.11.4/gdk/gdkdrawcontextprivate.h:25:
In file included from ../gtk-4.11.4/gdk/gdkmemoryformatprivate.h:24:
In file included from /usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl.h:89:
/usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl_generated.h:6829:9: warning: 'GL_INVALID_INDEX' macro redefined [-Wmacro-redefined]
#define GL_INVALID_INDEX 0xFFFFFFFF
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:1315:9: note: previous definition is here
#define GL_INVALID_INDEX 0xFFFFFFFFu
^
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c:29:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:23:
In file included from ../gtk-4.11.4/gdk/gdkglcontextprivate.h:24:
In file included from ../gtk-4.11.4/gdk/gdkdrawcontextprivate.h:25:
In file included from ../gtk-4.11.4/gdk/gdkmemoryformatprivate.h:24:
In file included from /usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl.h:89:
/usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl_generated.h:6831:9: warning: 'GL_TIMEOUT_IGNORED' macro redefined [-Wmacro-redefined]
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:1358:9: note: previous definition is here
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
^
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c:29:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:23:
In file included from ../gtk-4.11.4/gdk/gdkglcontextprivate.h:24:
In file included from ../gtk-4.11.4/gdk/gdkdrawcontextprivate.h:25:
In file included from ../gtk-4.11.4/gdk/gdkmemoryformatprivate.h:24:
In file included from /usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl.h:89:
/usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl_generated.h:9407:27: error: typedef redefinition with different types ('void (*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean)' (aka 'void (*)(unsigned int, int, unsigned int, int, int, unsigned char)') vs 'void (*)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean)' (aka 'void (*)(unsigned int, int, int, int, int, unsigned char)'))
typedef void (GLAPIENTRY *PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h:2461:25: note: previous definition is here
typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
^
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext.c:29:
In file included from ../gtk-4.11.4/gdk/macos/gdkmacosglcontext-private.h:23:
In file included from ../gtk-4.11.4/gdk/gdkglcontextprivate.h:24:
In file included from ../gtk-4.11.4/gdk/gdkdrawcontextprivate.h:25:
In file included from ../gtk-4.11.4/gdk/gdkmemoryformatprivate.h:24:
In file included from /usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl.h:89:
/usr/local/Cellar/libepoxy/1.5.10/include/epoxy/gl_generated.h:9411:27: error: typedef redefinition with different types ('void (*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean)' (aka 'void (*)(unsigned int, int, unsigned int, int, int, int, unsigned char)') vs 'void (*)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean)' (aka 'void (*)(unsigned int, int, int, int, int, int, unsigned char)'))
typedef void (GLAPIENTRY *PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
^
Is this an error in GTK 4 or my usage of command line arguments?
My guess is that I need to prevent the OS header /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl3.h
from being included. I don’t know how to do that.
Homebrew provides libexpoxy 1.5.10.
I don’t see anything in the gtk4.rb
to handle conflicts in OpenGL.
Thanks,
Paul.