无法使用foundationdb编译简单的go程序

ktca8awb  于 2023-04-18  发布在  Go
关注(0)|答案(1)|浏览(126)

尝试在macos arm for linux上交叉编译。我的示例项目如下所示:
main.go:

package main

import(
 "github.com/apple/foundationdb/bindings/go/src/fdb"
)

func main() {
        fdb.APIVersion(630)
        fdb.MustOpenDatabase("fdb.cluster")
}

go.mod

module fdbtest

go 1.19

require github.com/apple/foundationdb/bindings/go v0.0.0-20221026173525-97cc643cef69

require golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect

go.sum

github.com/apple/foundationdb/bindings/go v0.0.0-20221026173525-97cc643cef69 h1:vG55CLKOUgyuD15KWMxqRgTPNs8qQfXPtWjYYN5Wai0=
github.com/apple/foundationdb/bindings/go v0.0.0-20221026173525-97cc643cef69/go.mod h1:w63jdZTFCtvdjsUj5yrdKgjxaAD5uXQX6hJ7EaiLFRs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

我已经通过go get github.com/apple/foundationdb/bindings/go@6.3.25安装了foundationdb go lang绑定
但是当我执行env GOOS=linux GOARCH=amd64 go build时,我得到以下错误:

env GOOS=linux GOARCH=amd64 go build                                                                                       
# github.com/apple/foundationdb/bindings/go/src/fdb
../../../go/pkg/mod/github.com/apple/foundationdb/bindings/go@v0.0.0-20221026173525-97cc643cef69/src/fdb/keyselector.go:39:10: undefined: KeyConvertible
../../../go/pkg/mod/github.com/apple/foundationdb/bindings/go@v0.0.0-20221026173525-97cc643cef69/src/fdb/snapshot.go:33:3: undefined: transaction
../../../go/pkg/mod/github.com/apple/foundationdb/bindings/go@v0.0.0-20221026173525-97cc643cef69/src/fdb/generated.go:45:9: undefined: NetworkOptions
<...>
../../../go/pkg/mod/github.com/apple/foundationdb/bindings/go@v0.0.0-20221026173525-97cc643cef69/src/fdb/generated.go:94:9: too many errors

因此,它似乎无法从fdb中找到任何类型,但KeyConvertibleNetworkOptions(以及其他)存在于../../../go/pkg/mod/github.com/apple/foundationdb/bindings/go@v0.0.0-20221026173525-97cc643cef69/src/fdb/fdb.go
我的golang版本:go version go1.19.3 darwin/arm64
较新的fdb go绑定(7.1.25,7.1.0)似乎表现相同…
我错过了什么吗

相关问题