Search code examples
xcodemacosopenglglfwglew

glfw3 + OpenGL + glew on OSX now horribly broken


since I had somehow not managed to turn off automatic updates on my new Mac, Xcode decided to install it's latest and greatest version....and now my research project (molecular dynamics simulation) fails to build spectacularly. So I'm seeing if anybody else is having problems with graphics applications after updating.

For all of this, I am using homebrew on OSX, with the following packages:

  • gcc 5.4
  • glew 2.0.0
  • glfw 3.2.1
  • XQuartz 2.7.9

I need to use gcc rather than clang because I need access to OpenMP, and building the OpenMP setup along with clang on my mac has given me issues before. Anyway, I try to compile my code, and immediately get the endless streams of warnings from using GCC on a mac, but then I notice the following:

g++-5  -std=c++11 -Wno-deprecated-declarations -Wno-deprecated -D DEBUG -O0 -g -I/opt/X11/include -I/usr/X11R6/include -I/usr/include -I/usr/local/include -I/usr/local/include/gsl -MP -MMD -c src/minimum_distance.cpp -o obj/minimum_distance.o
In file included from src/graphics.cpp:1:0:
/usr/local/include/GL/glew.h:1203:28: fatal error: OpenGL/glu.h: No such file or directory

I try to end run this by copying the header files from /System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/ to /usr/local/include/OpenGL, which then allows me to build most of my project (no guarantees about it actually running), except at the end the linker barfs on the framework for OpenGL, which I have never seen before. I'm also confused as to how it misses the main OpenGL framework from FREAKING APPLE on the include, but w/e.

g++-5 <a whole crapload of .o files> -o bin/dragonfruit -gnu   -L/opt/X11/lib -lglfw3 -framework OpenGL -lglew  -lgsl -lgslcblas -L/usr/lib64 -lfftw3 -L/Users/cedelmaier/Projects/Biophysics/cytoscore/yaml-cpp/build -lyaml-cpp -L/usr/local/lib
ld: warning: directory not found for option '-L/usr/lib64'
ld: framework not found OpenGL
collect2: error: ld returned 1 exit status

When OpenGL most certainly exists on my mac. So has anybody run into this problem? I made sure that in fact, Xcode does run, and I have the command line tools installed. I uninstalled glfw3 and glew from homebrew and reinstalled them to no avail. Does anybody have any ideas on what might be needed to get this compiling and running again? I'm worried that even if it compiles, it won't have linked to the libraries correctly, and therefore won't even run.


Solution

  • I did have problems after upgrading and I solved them by switching to clang. This might be the most likely source of your problems and the fastest way to make things work again. Sorry I cannot be of more help.