ebiten: "unexpected '@' in program" running examples on macOS

On macOS 10.11.6 (El Capitan), with the latest ebiten from the master branch:

~/go/src/github.com/hajimehoshi/ebiten/examples/sprites [master|✔]
14:18 $ go run main.go
# github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/ca
ca.m:49:7: error: unexpected '@' in program
ca.m:54:13: warning: instance method '-setMaximumDrawableCount:' not found (return type defaults to 'id') [-Wobjc-method-access]
/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:44:12: note: receiver is instance of class declared here
ca.m:65:7: error: unexpected '@' in program
ca.m:68:37: warning: instance method '-setDisplaySyncEnabled:' not found (return type defaults to 'id') [-Wobjc-method-access]
/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:44:12: note: receiver is instance of class declared here

Not sure if this is a bug with ebiten, or if I’m just on too old a version of macOS now you’re using Metal for rendering.

Works fine with latest release (v1.8.1).

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Yeees! It would be impossible to remove all the warning, but I think that’s acceptable.

Thank you for cooperation!

Yep. Confirmed that this does work 😃

screen shot 2019-01-11 at 16 33 42

We do still get the warnings as before, but thats less important than the main thing, which is that it works 🎉

~/go/src/github.com/hajimehoshi/ebiten/examples/life [master|✔]
16:32 $ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/hajimehoshi/ebiten
   72c1a73c..dc0c6e09  master     -> origin/master
Updating 72c1a73c..dc0c6e09
Fast-forward
 internal/graphicscommand/driver_mac.go | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

~/go/src/github.com/hajimehoshi/ebiten/examples/life [master|✔]
16:32 $ go run main.go
# github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/ca
warning: unknown warning option '-Wno-unguarded-availability-new'; did you mean '-Wno-partial-availability'? [-Wunknown-warning-option]
# github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/ca
warning: unknown warning option '-Wno-unguarded-availability-new'; did you mean '-Wno-partial-availability'? [-Wunknown-warning-option]
# github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/ca
warning: unknown warning option '-Wno-unguarded-availability-new'; did you mean '-Wno-partial-availability'? [-Wunknown-warning-option]
ca.m:59:11: warning: instance method '-setMaximumDrawableCount:' not found (return type defaults to 'id') [-Wobjc-method-access]
/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:44:12: note: receiver is instance of class declared here
ca.m:77:35: warning: instance method '-setDisplaySyncEnabled:' not found (return type defaults to 'id') [-Wobjc-method-access]
/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h:44:12: note: receiver is instance of class declared here
# github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/ca
warning: unknown warning option '-Wno-unguarded-availability-new'; did you mean '-Wno-partial-availability'? [-Wunknown-warning-option]

Thank you for confirming!

Fixed to use OpenGL when macOS is 10.11 or older. (We have already confirmed that Metal worked on macOS 10.12 or newer).

Hmm, ok.

The cause is the usages of @available syntax.

https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/marking_api_availability_in_objective-c

I’m thinking to avoid this by macro. Please stay tuned (it’s also ok if you want to update macOS or Xcode now).