Hi, I have been using freeglut 3.x for quite some time successfully in Windows and Linux. Recently, a project requirement came up to use it on MacOS Catalina. I am having trouble building the static and shareable libraries with the cmake build environment (3.x). Basically, I get about 1/2 way through the build and then get these build errors below. I haven't found a solution to the problem yet... Am I missing something obvious here or is this a known issue with building freeglut under MacOS? Thanks...
[ 47%] Building C object CMakeFiles/freeglut.dir/src/x11/fg_window_x11_glx.c.o
[ 48%] Building C object CMakeFiles/freeglut.dir/src/util/xparsegeometry_repl.c.o
[ 50%] Linking C shared library lib/libglut.dylib
Undefined symbols for architecture x86_64:
"_glXChooseFBConfig", referenced from:
_fgPlatformGlutGetModeValues in fg_state_x11_glx.c.o
_fghChooseConfig in fg_window_x11_glx.c.o
"_glXCreateNewContext", referenced from:
_fghCreateNewContext in fg_window_x11_glx.c.o
"_glXDestroyContext", referenced from:
_fgPlatformDestroyContext in fg_init_x11.c.o
_fgPlatformCloseWindow in fg_window_x11.c.o
"_glXGetCurrentContext", referenced from:
_fgPlatformOpenWindow in fg_window_x11.c.o
"_glXGetFBConfigAttrib", referenced from:
_fgPlatformGetConfig in fg_state_x11_glx.c.o
_fgPlatformGlutGetModeValues in fg_state_x11_glx.c.o
_fghChooseConfig in fg_window_x11_glx.c.o
"_glXGetProcAddressARB", referenced from:
_fgPlatformGetProcAddress in fg_ext_x11.c.o
"_glXGetVisualFromFBConfig", referenced from:
_fgPlatformGlutGet in fg_state_x11.c.o
_fgPlatformOpenWindow in fg_window_x11.c.o
"_glXIsDirect", referenced from:
_fgPlatformOpenWindow in fg_window_x11.c.o
"_glXMakeContextCurrent", referenced from:
_fgPlatformOpenWindow in fg_window_x11.c.o
_fgPlatformSetWindow in fg_window_x11_glx.c.o
"_glXQueryExtension", referenced from:
_fgPlatformInitialize in fg_init_x11.c.o
"_glXQueryExtensionsString", referenced from:
_fgPlatformInitialize in fg_init_x11.c.o
"_glXSwapBuffers", referenced from:
_fgPlatformGlutSwapBuffers in fg_display_x11_glx.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: [lib/libglut.3.11.0.dylib] Error 1
make[1]: [CMakeFiles/freeglut.dir/all] Error 2
It looks like all the GLX functions are missing.
What we're linking with when it comes to OpenGL, is whatever the OpenGL cmake module sets to
OPENGL_gl_LIBRARY
after we do aFIND_PACKAGE(OpenGL)
. So this probably means that either your cmake OpenGL module is out of date, and something changed in catalina that moved GLX out of an existing library, or it finds the wrong cmake module that attempts to link with the "native" macos OpenGL framework instead of the X11/GLX based libraries.This is all more or less a guess. None of us freeglut maintainers are mac users that I know of, and I don't think there's even any mac users following the freeglut developers mailing list, so it's really up to you if you want to debug this. I'd start by doing a
make VERBOSE=1
, to see the linker command line, and see if there's something fishy about it.Thanks John T. for your response. I am using the latest cmake here; something happened it seems during the OpenGL deprecation process with Catalina, at least to the GLX/X11 environment. I futzed with this for hours but haven’t found a solution yet; if and when I do, I’ll update this bug report. It is a shame how Apple has made it so difficult to continue using OpenGL on their platform. I have read OpenGL support is even worse with the new “Big Sur” OS. I guess they really, really want users to abandon OpenGL in favor of their Metal API which I am sure is great, but is not exactly a portable solution obviously.
From: John Tsiombikas jtsiomb@users.sourceforge.net
Reply-To: "[freeglut:bugs]" 259@bugs.freeglut.p.re.sourceforge.net
Date: Sunday, December 6, 2020 at 2:31 AM
To: "[freeglut:bugs]" 259@bugs.freeglut.p.re.sourceforge.net
Subject: [EXTERNAL] [freeglut:bugs] #259 Builds fine on Windows; not so on MacOS?
It looks like all the GLX functions are missing.
What we're linking with when it comes to OpenGL, is whatever the OpenGL cmake module sets to OPENGL_gl_LIBRARY after we do a FIND_PACKAGE(OpenGL). So this probably means that either your cmake OpenGL module is out of date, and something changed in catalina that moved GLX out of an existing library, or it finds the wrong cmake module that attempts to link with the "native" macos OpenGL framework instead of the X11/GLX based libraries.
This is all more or less a guess. None of us freeglut maintainers are mac users that I know of, and I don't think there's even any mac users following the freeglut developers mailing list, so it's really up to you if you want to debug this. I'd start by doing a make VERBOSE=1, to see the linker command line, and see if there's something fishy about it.
[bugs:#259]https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Ffreeglut%2Fbugs%2F259%2F&data=04%7C01%7Cjohn.archdeacon%40nasa.gov%7Ce3228cf43b4b4413e15e08d899d21f09%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C637428475028260085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SKiEieocvXbESvGrMQYKNAsMpROfa8VJcbs2Ec8%2F7a4%3D&reserved=0 Builds fine on Windows; not so on MacOS?
Status: open
Group:
Labels: MacOS
Created: Sat Dec 05, 2020 09:57 PM UTC by John A
Last Updated: Sat Dec 05, 2020 09:57 PM UTC
Owner: nobody
Hi, I have been using freeglut 3.x for quite some time successfully in Windows and Linux. Recently, a project requirement came up to use it on MacOS Catalina. I am having trouble building the static and shareable libraries with the cmake build environment (3.x). Basically, I get about 1/2 way through the build and then get these build errors below. I haven't found a solution to the problem yet... Am I missing something obvious here or is this a known issue with building freeglut under MacOS? Thanks...
[ 47%] Building C object CMakeFiles/freeglut.dir/src/x11/fg_window_x11_glx.c.o
[ 48%] Building C object CMakeFiles/freeglut.dir/src/util/xparsegeometry_repl.c.o
[ 50%] Linking C shared library lib/libglut.dylib
Undefined symbols for architecture x86_64:
"_glXChooseFBConfig", referenced from:
_fgPlatformGlutGetModeValues in fg_state_x11_glx.c.o
_fghChooseConfig in fg_window_x11_glx.c.o
"_glXCreateNewContext", referenced from:
_fghCreateNewContext in fg_window_x11_glx.c.o
"_glXDestroyContext", referenced from:
_fgPlatformDestroyContext in fg_init_x11.c.o
_fgPlatformCloseWindow in fg_window_x11.c.o
"_glXGetCurrentContext", referenced from:
_fgPlatformOpenWindow in fg_window_x11.c.o
"_glXGetFBConfigAttrib", referenced from:
_fgPlatformGetConfig in fg_state_x11_glx.c.o
_fgPlatformGlutGetModeValues in fg_state_x11_glx.c.o
_fghChooseConfig in fg_window_x11_glx.c.o
"_glXGetProcAddressARB", referenced from:
_fgPlatformGetProcAddress in fg_ext_x11.c.o
"_glXGetVisualFromFBConfig", referenced from:
_fgPlatformGlutGet in fg_state_x11.c.o
_fgPlatformOpenWindow in fg_window_x11.c.o
"_glXIsDirect", referenced from:
_fgPlatformOpenWindow in fg_window_x11.c.o
"_glXMakeContextCurrent", referenced from:
_fgPlatformOpenWindow in fg_window_x11.c.o
_fgPlatformSetWindow in fg_window_x11_glx.c.o
"_glXQueryExtension", referenced from:
_fgPlatformInitialize in fg_init_x11.c.o
"_glXQueryExtensionsString", referenced from:
_fgPlatformInitialize in fg_init_x11.c.o
"_glXSwapBuffers", referenced from:
_fgPlatformGlutSwapBuffers in fg_display_x11_glx.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: [lib/libglut.3.11.0.dylib] Error 1
make[1]: [CMakeFiles/freeglut.dir/all] Error 2
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freeglut/bugs/259/https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Ffreeglut%2Fbugs%2F259%2F&data=04%7C01%7Cjohn.archdeacon%40nasa.gov%7Ce3228cf43b4b4413e15e08d899d21f09%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C637428475028260085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SKiEieocvXbESvGrMQYKNAsMpROfa8VJcbs2Ec8%2F7a4%3D&reserved=0
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fauth%2Fsubscriptions%2F&data=04%7C01%7Cjohn.archdeacon%40nasa.gov%7Ce3228cf43b4b4413e15e08d899d21f09%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C637428475028270041%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=BAAEpqqmFlAJ1Ua0%2Bb5SaGSzBuqa6muWSEeCRJSxKCY%3D&reserved=0
Related
Bugs: #259
Thanks for the quick response John T. I ended up disabling the build of the shareable library and was able to build the static library. Then, the problem simply shifted to applications trying to use the freeglut static library; i.e., as you pointed out, the GLX/X11 libraries being referenced by libfreeglut.a seem were deprecated by Apple; I haven't been successful yet in getting them restored in the MacOS Catalina version yet. If and when I find a way to get freeglut to work again on the Mac, I'll update this bug report.
I just tried to build freeglut on Mac OS 10.14 (Mojave) and got the exact same problem. I'm equally stumped on how to fix it.
For what it's worth, I was able to install freeglut successfully using MacPorts, but that didn't include the static library that I was hoping for (it does have several .dylib files though). It also came with several .cmake files which might have been useful, but all of my efforts to include them in my project using CMake failed, so I gave up.