Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake build with GCC on macOS fails #231

Open
snej opened this issue Jun 12, 2024 · 0 comments
Open

CMake build with GCC on macOS fails #231

snej opened this issue Jun 12, 2024 · 0 comments

Comments

@snej
Copy link
Contributor

snej commented Jun 12, 2024

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++-13

Results

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant