apple / foundationdb

FoundationDB - the open source, distributed, transactional key-value store
https://apple.github.io/foundationdb/
Apache License 2.0
14.6k stars 1.32k forks source link

Go Binding Generation: Requires a newer version of fdb_c.h #3338

Open morgangallant opened 4 years ago

morgangallant commented 4 years ago

Hi there - recently setup a small cluster to try out fdb, and having some trouble generating the Go bindings.

fdbcli --version

FoundationDB CLI 6.2 (v6.2.19)
source version 0a46c6276efc90ef425666e381d1e118c115854c
protocol fdb00b062010001

./fdb-go-install.sh install --fdbver 6.2.19

Downloading foundation repository into /home/morgan/go/src/github.com/apple:
git -C /home/morgan/go/src/github.com/apple clone --branch 6.2.19 https://github.com/apple/foundationdb.git
Cloning into 'foundationdb'...
remote: Enumerating objects: 90, done.
remote: Counting objects: 100% (90/90), done.
remote: Compressing objects: 100% (83/83), done.
remote: Total 71182 (delta 26), reused 16 (delta 7), pack-reused 71092
Receiving objects: 100% (71182/71182), 35.21 MiB | 14.82 MiB/s, done.
Resolving deltas: 100% (55683/55683), done.
Note: checking out '0a46c6276efc90ef425666e381d1e118c115854c'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

Building generated files.
make -C /home/morgan/go/src/github.com/apple/foundationdb bindings/c/foundationdb/fdb_c_options.g.h
make: Entering directory '/home/morgan/go/src/github.com/apple/foundationdb'
build/scver.mk:79: JAVA compiler is not installed on linux x86_64
Makefile:181: flow/actorcompiler/generated.mk: No such file or directory
Makefile:181: flow/coveragetool/generated.mk: No such file or directory
Makefile:181: fdbclient/vexillographer/generated.mk: No such file or directory
Makefile:181: flow/generated.mk: No such file or directory
Makefile:181: fdbrpc/generated.mk: No such file or directory
Makefile:181: fdbclient/generated.mk: No such file or directory
Makefile:181: fdbbackup/generated.mk: No such file or directory
Makefile:181: fdbserver/generated.mk: No such file or directory
Makefile:181: fdbcli/generated.mk: No such file or directory
Makefile:181: bindings/c/generated.mk: No such file or directory
Makefile:181: bindings/java/generated.mk: No such file or directory
Makefile:181: fdbmonitor/generated.mk: No such file or directory
Makefile:181: bindings/flow/tester/generated.mk: No such file or directory
Makefile:181: bindings/flow/generated.mk: No such file or directory
Creating       bindings/flow/generated.mk
Creating       bindings/flow/tester/generated.mk
Creating       fdbmonitor/generated.mk
Creating       bindings/java/generated.mk
Creating       bindings/c/generated.mk
Creating       fdbcli/generated.mk
Creating       fdbserver/generated.mk
Creating       fdbbackup/generated.mk
Creating       fdbclient/generated.mk
Creating       fdbrpc/generated.mk
Creating       flow/generated.mk
Creating       fdbclient/vexillographer/generated.mk
Creating       flow/coveragetool/generated.mk
Creating       flow/actorcompiler/generated.mk
build/scver.mk:79: JAVA compiler is not installed on linux x86_64
Building       bin/vexillographer.exe
Building       bindings/c/foundationdb/fdb_c_options.g.h
make: Leaving directory '/home/morgan/go/src/github.com/apple/foundationdb'
go run /home/morgan/go/src/github.com/apple/foundationdb/bindings/go/src/_util/translate_fdb_options.go < /home/morgan/go/src/github.com/apple/foundationdb/fdbclient/vexillographer/fdb.options > /home/morgan/go/src/github.com/apple/foundationdb/bindings/go/src/fdb/generated.go
# github.com/apple/foundationdb/bindings/go/src/fdb
In file included from src/fdb/cluster.go:26:0:
/home/morgan/go/src/github.com/apple/foundationdb/bindings/c/foundationdb/fdb_c.h:35:2: error: #error Requested API version requires a newer version of this header
 #error Requested API version requires a newer version of this header
  ^~~~~
Could not build FoundationDB go libraries.

Would appreciate any help here!

meyerbro commented 4 years ago

I'm having the same issue with FDB 6.2.22 or 6.2.27... Did you solve yours @morgangallant? Thanks.

ajbeamon commented 4 years ago

Let's see if we can identify where things have gone wrong. I'll use the paths from Morgan's post.

  1. In /home/morgan/go/src/github.com/apple/foundationdb/bindings/go/src/fdb/cluster.go, what version do you see in the line that looks like:
// #define FDB_API_VERSION 620
  1. In /home/morgan/go/src/github.com/apple/foundationdb/bindings/c/foundationdb/fdb_c.h, what version do you see in the line that looks like:
#elif FDB_API_VERSION > 620
  1. What OS are you using?
fletcherist commented 4 years ago

i've found out experimentally that golang bindings does not support versions above >6.1.13 github.com/apple/foundationdb/bindings/go v0.0.0-20190311170436-f2d582ffa197 this version works with 6.1.13

ccbrown commented 3 years ago

If you installed a released client library and let Go default to pulling bindings from the master branch, you'll almost definitely hit this error. The solution is to pin your bindings to the tag that's compatible with whatever you installed. For example, I just installed 6.2.28. For the Go bindings to work, I just have to explicitly pick a compatible release like so:

go get -u github.com/apple/foundationdb/bindings/go/src/fdb@release-6.2

It's not very Go-like at all, but it is a trivial fix. :-/

harikb commented 3 years ago

It would be great if the versions could be tagged appropriately. Either the go get method above or putting release-6.2 in the go.mod line for the binding will do the trick. However,

  1. go mod will soon replace clear tag of release-6.2 with a version/checksum
  2. Once it does that, it is very hard to differentiate the matching version from the incompatible version - both have 2021 releases
-       github.com/apple/foundationdb/bindings/go v0.0.0-20210225220716-e08ed81293f2 // this is 7.0.0 
+       github.com/apple/foundationdb/bindings/go v0.0.0-20210223161539-764f76eac34b // this is 6.2.x
harikb commented 3 years ago

Linking a ticket here https://github.com/golang/go/issues/26964