Skip to content

freeglut: require GL/glu.h #2118

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kusma
Copy link
Contributor

@kusma kusma commented May 21, 2025

Freeglut requires GL/glu.h, which isn't always installed. Make sure we check for it, so we can get a meaningful error message early on instead of just failing to compile.

Because not all platforms has glu as a dependency, we also need to fall back to searching for the library. This search is copied from Mesa's demos project.

@kusma kusma force-pushed the freeglut-search-for-glu branch from de8d1bf to 94e3882 Compare May 21, 2025 11:38
@kusma
Copy link
Contributor Author

kusma commented May 21, 2025

Seems like the MacOS build failure is caused by a github-actions issue: actions/runner-images#9966

@kusma
Copy link
Contributor Author

kusma commented May 21, 2025

Yeah, testing this locally works fine...

Copy link

@paulmenzel paulmenzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for coming up with a fix for my issue https://gitlab.freedesktop.org/mesa/demos/-/issues/50. The diff looks good to me.

required: false,
)
# GLU is part of OpenGL.Framework
if not dep_glu.found() and host_machine.system() != 'darwin'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't require the dependency on macOS, then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? Just because GLU is part of OpenGL.Framework doesn't mean Freeglut isn't useful on macOS, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you perhaps mix up GLU and GLUT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this check include and host_machine.system() != 'darwin'? The dependency() call specifies required: false, and on macOS we don't do the followup cc.find_library() call with implicit required: true, so the wrap ends up requiring GLU except on macOS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GLU is always required to build FreeGLUT, on all platforms.

I don't have a mac system at hand to test with, but my understanding is that on macOS, dep_glu will not be found, but because it doesn't have disabler: true, including it in freeglut_deps is benign. And on macOS, GLU will be available through dependency('gl'), which is already part of freeglut_deps.

So I'm not really sure what you think the problem is here. GLU will be found, just through another dependency on macOS.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And on macOS, GLU will be available through dependency('gl')

That answers it, thanks. Might be good to mention that in a comment, since it's not clear by inspection.

kusma added 2 commits June 23, 2025 16:49
Freeglut requires GL/glu.h, which isn't always installed. Make sure we
check for it, so we can get a meaningful error message early on instead
of just failing to compile.

Because not all platforms has glu as a dependency, we also need to fall
back to searching for the library. This search is copied from Mesa's
demos project.
Seems there's an issue where recent python versions will conflict with
the version provided by the runner-image. Let's try to work around it.

This feels a bit hacky, because we need to hard-code the specific
version, suggestions for improvements welcome.

See this ticket for details:
actions/runner-images#9966
@kusma kusma force-pushed the freeglut-search-for-glu branch from 6d4eff0 to 9fe557a Compare June 23, 2025 14:53
@@ -196,6 +196,10 @@ jobs:
python3 -m pip install license-expression
python3 -m pip install --pre meson

- name: Work around runner-images issue 9966
run: |
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit long as a one-liner. Any reason not to keep the original formatting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because that's what it seemed others were doing. I don't know YAML and formatting details well enough to know if the multi-line version would work or not without testing both.

I suppose I can try and see if it helps?

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 this pull request may close these issues.

3 participants