Closed leleliu008 closed 1 year ago
reported error messages
# github.com/anatol/smart.go /Users/runner/go/pkg/mod/github.com/anatol/smart.go@v0.0.0-20220917195147-c0b00d90f8cc/nvme.go:1209:10: undefined: NVMeDevice /Users/runner/go/pkg/mod/github.com/anatol/smart.go@v0.0.0-20220917195147-c0b00d90f8cc/nvme.go:1213:10: undefined: NVMeDevice /Users/runner/go/pkg/mod/github.com/anatol/smart.go@v0.0.0-20220917195147-c0b00d90f8cc/nvme.go:1228:10: undefined: NVMeDevice /Users/runner/go/pkg/mod/github.com/anatol/smart.go@v0.0.0-20220917195147-c0b00d90f8cc/smart.go:34:12: undefined: OpenNVMe
source version https://github.com/xxxserxxx/gotop/archive/v4.2.0.tar.gz
host environment
macos-11.7 x86_64
go env
GO111MODULE="auto" GOARCH="amd64" GOBIN="" GOCACHE="/Users/runner/Library/Caches/go-build" GOENV="/Users/runner/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/runner/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/runner/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org/,direct" GOROOT="/usr/local/Cellar/go/1.19.2/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.19.2/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.19.2" GCCGO="gccgo" GOAMD64="v1" AR="/Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar" CC="/opt/ppkg/core/bin/proxy-cc" CXX="/opt/ppkg/core/bin/proxy-c++" CGO_ENABLED="0" GOMOD="/opt/ppkg/installing/gotop/src/go.mod" GOWORK="" CGO_CFLAGS="-isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -Qunused-arguments -fPIC -fno-common -Os -Wno-error=unused-command-line-argument" CGO_CPPFLAGS="-I/opt/ppkg/installing/gotop/inc -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -Qunused-arguments -DNDEBUG" CGO_CXXFLAGS="-isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -Qunused-arguments -fPIC -fno-common -Os -Wno-error=unused-command-line-argument" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-L/opt/ppkg/installing/gotop/lib -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -Wl,-search_paths_first -Wl,-S" PKG_CONFIG="/usr/local/bin/pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map
build instruction
go build -trimpath -v -ldflags '-X main.Version=v4.2.0 -X main.BuildDate=20221030T141516 -s -w' -o ./out/ ./cmd/gotop
cgo must be enabled when building on macOS.
following config will do the trick:
export CGO_ENABLED=1
this infomation is very important, but it is not motioned in README.
README
reported error messages
source version https://github.com/xxxserxxx/gotop/archive/v4.2.0.tar.gz
host environment
go env
build instruction