For folks on MacOS who already have fdb installed on their machines, compilation fails like so:
In file included from src/github.com/apple/foundationdb/bindings/go/src/fdb/database.go:26:
/usr/local/include/foundationdb/fdb_c.h:34:2: error: Requested API version requires a newer version of this header
#error Requested API version requires a newer version of this header
^
1 error generated.
ninja: build stopped: subcommand failed.
This is because /usr/local/include ends up ahead of the build directory with the way we currently set it.
$ C_INCLUDE_PATH=/Users/anoyes/workspace/foundationdb/build/bindings/c/foundationdb:/Users/anoyes/workspace/foundationdb/bindings/c clang -E -x c - -v < /dev/null
...
#include <...> search starts here:
/usr/local/include
/Users/anoyes/workspace/foundationdb/build/bindings/c/foundationdb
/Users/anoyes/workspace/foundationdb/bindings/c
...
We can use -I
to put things ahead of /usr/local/include
, and the build succeeds after this patch:
diff --git a/bindings/go/CMakeLists.txt b/bindings/go/CMakeLists.txt
index cf4aeb1aa..31e270199 100644
--- a/bindings/go/CMakeLists.txt
+++ b/bindings/go/CMakeLists.txt
@@ -42,7 +42,7 @@ file(MAKE_DIRECTORY ${GOPATH}
set(go_options_file ${GO_DEST}/src/fdb/generated.go)
set(go_env GOPATH=${GOPATH}
- C_INCLUDE_PATH=${CMAKE_BINARY_DIR}/bindings/c/foundationdb:${CMAKE_SOURCE_DIR}/bindings/c
+ CGO_CFLAGS="-I${CMAKE_BINARY_DIR}/bindings/c/foundationdb;-I${CMAKE_SOURCE_DIR}/bindings/c"
CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/lib
GO111MODULE=auto)