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

Build error on macOS 11.2.3+Xcode 12.4+cmake 3.19 #4286

Closed
tom-seddon opened this issue Apr 6, 2021 · 4 comments
Closed

Build error on macOS 11.2.3+Xcode 12.4+cmake 3.19 #4286

tom-seddon opened this issue Apr 6, 2021 · 4 comments

Comments

@tom-seddon
Copy link

macOS 11.2.3
Xcode 12.4
cmake version 3.19.20201025-gd749d46

Repro steps: (commit 0f4aba7 is HEAD at time of writing)

cd /tmp
git clone https://github.com/libsdl-org/SDL
cd SDL
git checkout 0f4aba7bcdc6aa8671c1f93700266b0e8907cc70
mkdir ../SDL.cmake
cd ../SDL.cmake
cmake ../SDL/
make

Expected result: SDL builds

Actual result: a bunch of errors that look like it's attempting to build Objective C code as C, e.g.:

[  0%] Building C object CMakeFiles/SDL2.dir/src/file/cocoa/SDL_rwopsbundlesupport.m.o
In file included from /tmp/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m:24:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:492:1: error:
      expected identifier or '('
@class NSString, Protocol;
^
@tom-seddon
Copy link
Author

tom-seddon commented Apr 6, 2021

I'd completely forgotten that I'd previously submitted 4b35a18 - vaguely similar symptoms, as I recall. And now I'm reminded of it, I remember it having to be reverted (see 45e3521), so I'm not going to attempt a fix for this issue. Just a report. I can just continue to build with Xcode 11 on my other laptop for now.

Looks like #4274 might also be the same kind of thing.

@natbro
Copy link

natbro commented Apr 7, 2021

is this possibly a problem with your cmake 3.19.20201025-gd749d46 ? I'm able to build without issues on macOS 11.2.3+ and Xcode 12.4. .m files are automatically built with -ObjC

@tom-seddon
Copy link
Author

Thanks for the suggestion - I upgraded to cmake 3.20, and it now builds. Presumably something in Xcode changed.

@okuoku
Copy link
Contributor

okuoku commented Apr 10, 2021

In regard of #4274 it was a bit more complex.

In CMake 3.19.1, it dropped language enforcement with LANGUAGE property, and that was why your update to 3.20 fixed issue.

Unfortunately, Xcode generator still does not allow LANGUAGE to C override if one had enable_language'ed OBJC or OBJCXX and that was my case -- my project builds ANGLE as OpenGL ES implementation and other METAL based middlewares alongside SDL. These include enable_language(OBJCXX) thus #4274 was created to support this project structure but it drops earlier CMake and now-unsupported OSX SDKs.

I feel requiring CMake 3.16 (was released in 2019Nov) is a bit too early and seeking workaround..

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

3 participants