Closed ilovezfs closed 6 years ago
Honestly we should start by hooking up some macos builders in Travis, and writing some more tests for it.
The OSX builder on the free Travis instance is permanently backed up, but I can try enabling it.
@ebassi I think they end up being effectively serialized. I switched xserver's travis to only make one runner for whatever the newest OSX is, and that's usually quick enough. If we wanted more elaborate coverage we could set up the yml to start the full OSX test matrix only on specially named git branches.
@nwnk I've added the osx builder on the Travis CI matrix, and massaged the build script so that it runs; need to run the test suite as well, and check if the build options matrix is working as intended
@ilovezfs Could you have a look at #178 and check if that fixes the build for you?
Additionally, it would be great to have a small test case we can add to the suite, so that we can run it on macOS and ensure we're not regressing at run time.
To be fair, though, it seems that the errors you're seeing when building your test code are actually coming from macOS; it's hard to find some documentation that is not hopelessly outdated on how to build OpenGL code with C and Carbon.
Those warnings seem to be caused by a missing #include <OpenGL/OpenGL.h>
in the test. If add that then I get
==> /usr/bin/clang test.c -L/usr/local/Cellar/libepoxy/1.5.3-alpha1/lib -lepoxy -framework OpenGL -o test
test.c:18:23: warning: incompatible pointer types passing 'CGLPixelFormatObj' (aka 'struct _CGLPixelFormatObject *') to parameter of type 'CGLContextObj _Nonnull' (aka 'struct _CGLContextObject *') [-Wincompatible-pointer-types]
CGLReleaseContext(pix);
^~~
/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:53:45: note: passing argument to parameter 'ctx' here
extern void CGLReleaseContext(CGLContextObj ctx) OPENGL_AVAILABLE(10_5);
^
1 warning generated.
So something is still a bit off with our test.
@ilovezfs Thanks for testing; I've added your test to #179, with a fix for the wrong use of CGLReleaseContext()
. Could you please add some licensing notes for the test, so I can accurately credit the authors?
The test is from the original formula added in https://github.com/Homebrew/legacy-homebrew/pull/34345
From the comments, the test was written by @scoopr. See https://github.com/Homebrew/legacy-homebrew/pull/34345#issuecomment-74938134 https://github.com/scoopr/homebrew/commit/ae259fa3eb91884c8b88c5b6f8b0866419a4dc5c
Yup, your revised test runs without warnings or errors:
==> /usr/bin/clang test.c -L/usr/local/Cellar/libepoxy/1.5.3-alpha1/lib -lepoxy -framework OpenGL -o test
==> ls -lh test
-rwxr-xr-x 1 joe admin 8.6K May 30 01:45 test
==> file test
test: Mach-O 64-bit executable x86_64
==> ./test
In terms of licensing, it's all BSD 2-clause "Simplified" License. See https://github.com/Homebrew/homebrew-core/#license
@ilovezfs Brilliant, thanks!
You're welcome!
Regressed by https://github.com/anholt/libepoxy/pull/170
The test block runs
The problem is that although OPENGL_LIB gets defined for
__APPLE__
at https://github.com/anholt/libepoxy/blob/791b28c186882eb8d56f1002acda1dbb4ac00de3/src/dispatch_common.c#L178 asit then gets redefined generically in the else at https://github.com/anholt/libepoxy/blob/791b28c186882eb8d56f1002acda1dbb4ac00de3/src/dispatch_common.c#L199 as
As a workaround in the Homebrew formula, I can
A proper fix will probably involve guarding the generic
#define OPENGL_LIB "libOpenGL.so.0"
with an ifndef, or reorganizing the directives a bit.Ref: https://github.com/Homebrew/homebrew-core/pull/28037
CC @ebassi @nwnk