-
Notifications
You must be signed in to change notification settings - Fork 35
Description
I'm trying to build Fleece with GCC 13 on my Mac, just so I can catch more build errors locally before pushing a PR. Unfortunately it doesn't work, because GCC doesn't appear to understand 'modern' Objective-C at all.
Steps to repro
After installing GCC with Homebrew, I just do this before running cmake:
export CC=/opt/homebrew/bin/gcc-13
export CXX=/opt/homebrew/bin/g++-13Results
It fails with a bunch of instances of this error:
g++-13: error: unrecognized command-line option '-fobjc-arc'; did you mean '-fobjc-gc'?
I modified platform_apple.cmake to set the -fobjc-arc flag only with AppleClang. Then it emits this warning:
/Users/snej/Couchbase/CBL_C/vendor/couchbase-lite-core/vendor/fleece/Fleece/API_Impl/Fleece.cc:36:29: warning: 'visibility' attribute ignored [-Wattributes]
36 | FLEECE_PUBLIC const FLValue kFLNullValue = Value::kNullValue;
| ^~~~~~~~~~~~
followed by literally a bajillion errors in the .mm files due to GCC not understanding Obj-C block syntax (^), the nullable keyword, generic interfaces (like @interface NSEnumerator<ObjectType>), and on and on...
Analysis
Looks like we need to skip all the .mm files when building with GCC; that's fine since I don't intend to use the build products, just look for errors before they occur in CI.
Unfortunately I don't know CMake well enough to figure out how to conditionally remove them from platform_apple.cmake. All my attempts have resulted in cryptic errors from the cmake tool.