undefined: stream - Issue with Mac OS M2
LordMoMA opened this issue · comments
On Linux Ubuntu, it does not have the below problem, but OS M2 has:
# github.com/rjeczalik/notify
../../../pkg/mod/github.com/rjeczalik/notify@v0.9.2/watcher_fsevents.go:49:11: undefined: stream
../../../pkg/mod/github.com/rjeczalik/notify@v0.9.2/watcher_fsevents.go:200:13: undefined: newStream
stream is defined at
notify/watcher_fsevents_cgo.go
Line 117 in 8c8ecfe
Make sure you build with cgo and the other expected flags I guess
If I built with CGO_ENABLED=1
, it generates other problems, and the pod could not be spun up
CGO_ENABLED=1 go build -ldflags "-s -w" ./cmd/crypto-tron
CGO_ENABLED=1 go build -ldflags "-s -w" ./cmd/crypto-tron
# github.com/karalabe/hid
In file included from ../../../../.gvm/pkgsets/system/global/pkg/mod/github.com/karalabe/hid@v1.0.0/hid_enabled.go:38:
../../../../.gvm/pkgsets/system/global/pkg/mod/github.com/karalabe/hid@v1.0.0/hidapi/mac/hid.c:693:34: warning: 'kIOMasterPortDefault' is deprecated: first deprecated in macOS 12.0 [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:133:19: note: 'kIOMasterPortDefault' has been explicitly marked deprecated here
# github.com/rjeczalik/notify
cgo-gcc-prolog:217:2: warning: 'FSEventStreamScheduleWithRunLoop' is deprecated: first deprecated in macOS 13.0 - Use FSEventStreamSetDispatchQueue instead. [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/FSEvents.framework/Headers/FSEvents.h:1138:1: note: 'FSEventStreamScheduleWithRunLoop' has been explicitly marked deprecated here
I think most of these warnings were fixed in #215 make sure you using the latest code
Anyway, I don't see why deprecation warnings failed the build , you sure that's the whole relevant output?
problem solved by upgrading to the latest version and set CGO_ENABLED=0
, why we don't need CGO here?
If you build without cgo you'd actually be using kqueue and not fsevents.
fsevents condition is //go:build darwin && !kqueue && cgo
kqueue condition is //go:build (darwin && kqueue) || (darwin && !cgo) || ...
kqueue might very well suit your needs, depending on your usage of this library.
thank you for the knowledge here ❤️