LancePutnam / Gamma

Generic (Sound) Synthesis Library
Other
458 stars 54 forks source link

macOS 11 build breaks #56

Open akshay1992 opened 3 years ago

akshay1992 commented 3 years ago

Hey! I just upgraded to macOS 11 and it seems like it can't find the cmath header anymore.

> make 
CXX src/arr.cpp build/obj/arr.o
clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
src/arr.cpp:4:10: fatal error: 'cmath' file not found
#include <cmath>
         ^~~~~~~
1 error generated.
make: *** [build/obj/arr.o] Error 1

I did a bit of digging around, and it seems like the problem lies in Makefile.common:233.

    CFLAGS += -isysroot $(OSX_SDK_PATH)$(OSX_SDK) -mmacosx-version-min=10.$(OSX_VERSION)

My hunch is that target SDK version and the -mmacosx-version-min have to have the same major version number. If I change the above line to the following, it seems to work.

    CFLAGS += -isysroot $(OSX_SDK_PATH)$(OSX_SDK) -mmacosx-version-min=11.$(OSX_VERSION)

Alternatively, if I simply remove the minimum version flag, it build successfully. See below:

    CFLAGS += -isysroot $(OSX_SDK_PATH)$(OSX_SDK)

Taking a closer look at my SDKs directory, I see the following, which would partially explains my hunch.

> ls /Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
DriverKit20.0.sdk/ MacOSX.sdk/        MacOSX11.0.sdk@

I'm not intimately familiar with how macOS SDK targeting works, but I thought I'd share my initial investigation. Thanks!