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

x/exp/shiny: Shiny does not compile on macOS #22634

Closed
Varunram opened this issue Nov 8, 2017 · 12 comments
Closed

x/exp/shiny: Shiny does not compile on macOS #22634

Varunram opened this issue Nov 8, 2017 · 12 comments

Comments

@Varunram
Copy link

Varunram commented Nov 8, 2017

What version of Go are you using (go version)?

go10.9

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

macOS 10.13, amd64

What did you do?

go get golang.org/x/exp/shiny/driver/gldriver

What did you expect to see?

Instead of getting the package, go spawns an error

What did you see instead?

cocoa.m:24:5: error: redefinition of enumerator 'NSEventTypeScrollWheel'
/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:40:5: note: previous definition is here
cocoa.m:25:5: error: redefinition of enumerator 'NSEventTypeKeyDown'
/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:32:5: note: previous definition is here
cocoa.m:28:5: error: redefinition of enumerator 'NSWindowStyleMaskTitled'
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:36:5: note: previous definition is here
cocoa.m:29:5: error: redefinition of enumerator 'NSWindowStyleMaskResizable'
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:39:5: note: previous definition is here
cocoa.m:30:5: error: redefinition of enumerator 'NSWindowStyleMaskMiniaturizable'
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:38:5: note: previous definition is here
cocoa.m:31:5: error: redefinition of enumerator 'NSWindowStyleMaskClosable'
/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:37:5: note: previous definition is here
@bradfitz bradfitz changed the title cmd/go: Shiny does not compile on macOS x/exp/shiny: Shiny does not compile on macOS Nov 8, 2017
@gopherbot gopherbot added this to the Unreleased milestone Nov 8, 2017
@tomheng
Copy link
Contributor

tomheng commented Nov 10, 2017

you can try this cl:

https://go-review.googlesource.com/c/exp/+/31546

@Varunram
Copy link
Author

Varunram commented Nov 10, 2017

Thanks for replying. I tried applying the patch, but am getting

# github.com/Varunram/nucular/vendor/golang.org/x/exp/shiny/driver/gldriver
cocoa.m:201:11: error: conflicting types for 'doNewWindow'
go/src/github.com/Varunram/nucular/vendor/golang.org/x/exp/shiny/driver/gldriver/cocoa.go:25:11: note: previous declaration is here

From what I can understand, the go and obj-c declarations are different. Would changing them work?

EDIT: the patch works, thanks! Had a couple of unrelated changes which interfered and caused the above error

@nigeltao
Copy link
Contributor

I don't use a Mac for my day to day programming, and I'm not so familiar with the macOS driver for Shiny. That was mostly @crawshaw's work.

Still, @tomheng's general approach looks plausible. The minus sign instead of a less than or greater than in x/exp/shiny/driver/gldriver/cocoa.m's

#define IS_MAC_SIERRA_OR_LATER (NSAppKitVersionNumber - NSAppKitVersionNumber10_11)

certainly looks a little odd, if not a bug.

cl/31546 says "DO NOT SUBMIT; DO NOT REVIEW" but I'm happy to review a simple CL along those lines, especially if somebody can confirm that it works for both 10.13 High Sierra and 10.12 Sierra. Bonus points for additional confirmation on an earlier version (e.g. 10.11 El Capitan), since the existing cocoa.m code is "#if !IS_MAC_SIERRA_OR_LATER".

@beardww
Copy link

beardww commented Dec 5, 2017

I was getting this error as well. Removing the IS_MAC_SIERRA_OR_LATER check in cocoa.m fixed this issue, and I was able to build some shiny =]

Go version go1.8.3 darwin/amd64
macOS 10.13.1, amd64

It appears as if the check isn't working for some reason, re: (NSAppKitVersionNumber - NSAppKitVersionNumber10_11)

@driusan
Copy link

driusan commented Dec 7, 2017

I tried 31546 on my Mac (High Sierra), and it seems to work here. Does anyone know why it says "DO NOT SUBMIT; DO NOT REVIEW" in the CL?

@Varunram
Copy link
Author

Varunram commented Dec 8, 2017

No idea why, maybe they don't want distro specific solutions.

@nigeltao
Copy link
Contributor

nigeltao commented Dec 8, 2017

I can't speak for @tomheng, but I'll repeat that, despite not using a Mac regularly, I'm happy to review a simple CL along those lines, especially if somebody can confirm that it works for both 10.13 High Sierra and 10.12 Sierra.

@Varunram
Copy link
Author

Varunram commented Dec 8, 2017

@nigeltao Oh, that's what you meant? my bad, I'll test on a Sierra machine and get back to you with a PR.

@tomheng
Copy link
Contributor

tomheng commented Dec 8, 2017

@nigeltao I had updated the CL for review, but I can only confirm it work on 10.12 Sierra, that is the
reason not to submit for review.

@nigeltao
Copy link
Contributor

nigeltao commented Dec 8, 2017

@tomheng says it works for 10.12 Sierra and @driusan says that it works for 10.13 High Sierra. I just approved cl/31546 (except for some minor style issues). @Varunram I don't think you need to make your own PR.

@gopherbot
Copy link

Change https://golang.org/cl/31546 mentions this issue: shiny/driver: use __MAC_OS_X_VERSION_MAX_ALLOWED for conditional compilation

@Varunram
Copy link
Author

Varunram commented Dec 9, 2017

Thanks a lot @nigeltao and @tomheng for fixing this!

as added a commit to as/shiny that referenced this issue May 3, 2018
as added a commit to as/shiny that referenced this issue May 3, 2018
@golang golang locked and limited conversation to collaborators Dec 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants