Availability.h file not found (from glew.h)

Hi all,
after an OSX update I cannot build OF anymore, so I thought I’d write here, in case somebody already banged on the same issue and -hopefully- to find and document a solution.

So:
OF version: 0.11.1 from the website
OSX version: 10.14.6
Xcode version: 11.3

Error:
Availability.h file not found

The error is triggered when including glew.h, which which in turn has a platform specific define, including Availability.h on Mac.
My first guess is that I used to have Availability.h, but it got wiped during the last update; since I’m on a fairly vintage OSX version I suppose that, if this is the case, it is likely the same thing happened to other people as well, but I did not find previous posts about this specific issue, which makes me wonder if something trickier is happening here.

Hopefully somebody has an idea :slight_smile:
Thanks in advance

Hmm I think that could be related to not having the Command Line Tools installed.

If you type

xcode-select -p
in a terminal window what do you get?:

For me my Xcode 11.2.1 install is at /Applications/Xcode.app
And I get:

/Applications/Xcode.app/Contents/Developer

Also if you type gcc or make in the terminal it might prompt you to install the command line tools.

Thanks for your answer Theo:

xcode-select -p
returns:
/Applications/Xcode.app/Contents/Developer

gcc and make still worked fine on non-OF projects: now I tried to make an OF project and it built correctly. Still I cannot build from within XCode. Weird.

More detail:
The XCode issue seem to happen every time ofConstants.h is included:

CompileC /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/Objects-normal/x86_64/ofVec2f.o /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworks/math/ofVec2f.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'openFrameworks' from project 'openFrameworksLib')
    cd /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/project/osx
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target x86_64-apple-macos10.9 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++11 -stdlib=libc++ -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wno-unused-value -Wno-empty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.4u.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Wno-invalid-offsetof -g -mssse3 -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -iquote /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/openFrameworksDebug-generated-files.hmap -I/Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/openFrameworksDebug-own-target-headers.hmap -I/Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/openFrameworksDebug-all-target-headers.hmap -iquote /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/openFrameworksDebug-project-headers.hmap -I/Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/include -I../../../../libs/openFrameworks -I../../../../libs/openFrameworks/.settings -I../../../../libs/openFrameworks/3d -I../../../../libs/openFrameworks/app -I../../../../libs/openFrameworks/communication -I../../../../libs/openFrameworks/events -I../../../../libs/openFrameworks/gl -I../../../../libs/openFrameworks/graphics -I../../../../libs/openFrameworks/math -I../../../../libs/openFrameworks/sound -I../../../../libs/openFrameworks/types -I../../../../libs/openFrameworks/utils -I../../../../libs/openFrameworks/video -I../../../../libs/openFrameworks/gl/shaders -I../../../../libs/freetype/include -I../../../../libs/freetype/include/freetype2 -I../../../../libs/fmodex/include -I../../../../libs/glew/include -I../../../../libs/FreeImage/include -I../../../../libs/tess2/include -I../../../../libs/cairo/include/cairo -I../../../../libs/rtAudio/include -I../../../../libs/glfw/include -I../../../../libs/boost/include -I../../../../libs/utf8/include -I../../../../libs/json/include -I../../../../libs/glm/include -I../../../../libs/curl/include -I../../../../libs/uriparser/include -I../../../../libs/pugixml/include -I/Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/DerivedSources-normal/x86_64 -I/Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/DerivedSources/x86_64 -I/Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/DerivedSources -F/Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx -D__MACOSX_CORE__ -MMD -MT dependencies -MF /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/Objects-normal/x86_64/ofVec2f.d --serialize-diagnostics /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/Objects-normal/x86_64/ofVec2f.dia -c /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworks/math/ofVec2f.cpp -o /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworksCompiled/lib/osx/build/debug/openFrameworks.build/Objects-normal/x86_64/ofVec2f.o
In file included from /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworks/math/ofVec2f.cpp:1:
In file included from ../../../../libs/openFrameworks/math/ofVec2f.h:6:
In file included from /Users/naus3a/Documents/OF/of_v0.11.0_osx_release/libs/openFrameworks/utils/ofConstants.h:182:
../../../../libs/glew/include/GL/glew.h:1189:14: fatal error: 'Availability.h' file not found
#    include <Availability.h>
             ^~~~~~~~~~~~~~~~
1 error generated.

If I look for it with finder, Avaialbility.h is not my disk, so this part kinda makes sense, and since glew.h surely did not change, it’s the reason why my first thought was that somehow the update could have deleted that header.
But now that I see that make works, I think the reason must be something different.