Does this thing compile on M1?
Closed this issue · 5 comments
GOOS=darwin GOARCH=arm64 go build -a -tags netgo -ldflags
GO111MODULE="off"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/davidrenne/Library/Caches/go-build"
GOENV="/Users/davidrenne/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/davidrenne/Atlona-Dev/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/davidrenne/Atlona-Dev"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.12"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0_/nswys1md33gflzj54n8r415r0000gn/T/go-build4155332733=/tmp/go-build -gno-record-gcc-switches -fno-common"
And I get this stack trace when building:
# fyne.io/systray
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:71:2: undefined: setInternalLoop
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:74:2: undefined: nativeLoop
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:82:9: undefined: nativeStart
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:82:22: undefined: nativeEnd
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:110:2: undefined: registerSystray
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:115:2: undefined: resetMenu
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:120:14: undefined: quit
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:145:2: undefined: addSeparator
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:199:2: undefined: hideMenuItem
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:204:2: undefined: showMenuItem
/Users/davidrenne/Atlona-Dev/pkg/mod/fyne.io/systray@v1.10.0/systray.go:204:2: too many errors
It'd be nice if I have the same tray as amd64 on OSX. How can this be implemented for arm?
Yes it should compile on M1 - the darwin code is not platform specific.
When cross-compiling as you illustrate you will need CGO_ENABLED=1
yea @andydotxyz I dont use CGO_ENABLED on the mac build, but it still compiles fine without errors. Why is that? I barely read the docs on this library as I was using existing code and found this fork because it worked on ubuntu/linux whereas the old fork does not. Nice that you guys compile for M1 too, but why do I have to enable CGO on M1 when on the normal one that uses the same system tray package code, I just build like this GOOS=darwin GOARCH=amd64 go build -a -ldflags
CGO_ENABLED for M1 did compile fine though, now I have to find a friend with an AppleSilicon chip to test it someday.
CGO is enabled by default when not cross compiling.
@Jacalz thanks for the info