apple / foundationdb

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

bindings/go: error "No rule to make target fdb_c_options.g.h" #5613

Open uh-zuh opened 2 years ago

uh-zuh commented 2 years ago

As mentioned there: https://github.com/apple/foundationdb/tree/master/bindings/go I run only one command and get error:

> ./fdb-go-install.sh install --fdbver 6.3.15
Downloading foundation repository into /home/egor/go/src/github.com/apple:
git -C /home/egor/go/src/github.com/apple clone --branch 6.3.15 https://github.com/apple/foundationdb.git
Cloning into 'foundationdb'...
remote: Enumerating objects: 118747, done.
remote: Counting objects: 100% (232/232), done.
remote: Compressing objects: 100% (164/164), done.
remote: Total 118747 (delta 124), reused 103 (delta 68), pack-reused 118515
Receiving objects: 100% (118747/118747), 68.54 MiB | 7.59 MiB/s, done.
Resolving deltas: 100% (93870/93870), done.
Note: checking out 'c3ccd7d23675932a26c9958dbb53e31f5a49ccd5'.

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/egor/go/src/github.com/apple/foundationdb bindings/c/foundationdb/fdb_c_options.g.h
make: Entering directory '/home/egor/go/src/github.com/apple/foundationdb'
make: *** No rule to make target 'bindings/c/foundationdb/fdb_c_options.g.h'.  Stop.
make: Leaving directory '/home/egor/go/src/github.com/apple/foundationdb'
Could not generate required c header

I try it in Ubuntu 18.04 LTS on Windows.

jzhou77 commented 2 years ago

fdb_c_options.g.h is part of fdb_c. This is fixed on master branch. To bypass this problem, you can build fdb_c first, and then do the go install.

aduermael commented 2 years ago

I have the same issue. I can't find the right instructions to build fdb_c and get this fdb_c_options.g.h file. Can you point me into the right direction @jzhou77 please?

damienleroux commented 2 years ago

I tried the master branch and I have the same problem.

Does anyone succeed in bypassing this?

Where can I find fdb_c_options.g.h?

🙏

edit: I found another way to get it. I installed the client package:

mkdir /etc/resource
wget https://www.foundationdb.org/downloads/6.3.18/ubuntu/installers/foundationdb-clients_6.3.18-1_amd64.deb -P /etc/resource/
sudo dpkg -i /etc/resource/foundationdb-clients_6.3.18-1_amd64.deb
ls /usr/include/foundationdb/
# fdb.options  fdb_c.h  fdb_c_options.g.h
euskadi31 commented 9 months ago

I have same problem with fdb 7.1.36 on macOS 13.4.1 (a)

mkdir build
cd build
cmake ../
make -j4 fdb_c
...
[ 88%] Building CXX object fdbclient/CMakeFiles/fdbclient.dir/FDBOptions.g.cpp.o
[ 88%] Linking CXX static library ../lib/libfdbclient.a
[100%] Built target fdbclient
[100%] Building ASM object bindings/c/CMakeFiles/fdb_c.dir/fdb_c.g.S.o
[100%] Building CXX object bindings/c/CMakeFiles/fdb_c.dir/fdb_c.cpp.o
[100%] Linking CXX shared library ../../lib/libfdb_c.dylib
ld: warning: disabling chained fixups because of unaligned pointers
[100%] Built target fdb_c
Building generated files.
make -C /Users/aetcheverry/Projects/poc/build/foundationdb bindings/c/foundationdb/fdb_c_options.g.h
make: *** No rule to make target `bindings/c/foundationdb/fdb_c_options.g.h'.  Stop.
Could not generate required c header
jzhou77 commented 9 months ago

This is how fdb_c_options.g.h is generated (copied from build.ninja file).

# Custom command for fdbclient/include/fdbclient/fdb_c_options.g.h

build fdbclient/include/fdbclient/fdb_c_options.g.h | ${cmake_ninja_workdir}fdbclient/include/fdbclient/fdb_c_options.g.h: CUSTOM_COMMAND /root/src/foundationdb/fdbclient/vexillographer/fdb.options || vexillographer
  COMMAND = cd /root/cbuild_output/fdbclient && /usr/bin/mono /root/cbuild_output/vexillographer.exe /root/src/foundationdb/fdbclient/vexillographer/fdb.options c /root/cbuild_output/fdbclient/include/fdbclient/fdb_c_options.g.h
  DESC = Generate FDBOptions c files
  restat = 1
# Custom command for fdbclient/include/fdbclient/FDBOptions.g.h

build fdbclient/include/fdbclient/FDBOptions.g.h | ${cmake_ninja_workdir}fdbclient/include/fdbclient/FDBOptions.g.h: CUSTOM_COMMAND fdbclient/FDBOptions.g.h || fdbclient/fdboptions_c vexillographer
  COMMAND = cd /root/cbuild_output/fdbclient && /usr/local/bin/cmake -E copy /root/cbuild_output/fdbclient/FDBOptions.g.h /root/cbuild_output/fdbclient/include/fdbclient/FDBOptions.g.h
  DESC = Generating include/fdbclient/FDBOptions.g.h
  restat = 1

We usually compile insider build docker image with command like CC=clang CXX=clang++ LD=lld cmake -S ${HOME}/src/foundationdb -B ${HOME}/cbuild_output -D USE_LD=LLD -D USE_WERROR=ON -D USE_LIBCXX=1 -G Ninja && ninja -C ${HOME}/cbuild_output

vexillographer.exe is compiled from C# code:

# Custom command for vexillographer.exe

build vexillographer.exe | ${cmake_ninja_workdir}vexillographer.exe: CUSTOM_COMMAND /root/src/foundationdb/fdbclient/vexillographer/c.cs /root/src/foundationdb/fdbclient/vexillographer/cpp.cs /root/src/foundationdb/fdbclient/vexillographer/java.cs /root/src/foundationdb/fdbclient/vexillographer/python.cs /root/src/foundationdb/fdbclient/vexillographer/ruby.cs /root/src/foundationdb/fdbclient/vexillographer/vexillographer.cs
  COMMAND = cd /root/cbuild_output && /usr/bin/mcs -r:System,System.Core,System.Data,System.Xml,System.Xml.Linq /root/src/foundationdb/fdbclient/vexillographer/c.cs /root/src/foundationdb/fdbclient/vexillographer/cpp.cs /root/src/foundationdb/fdbclient/vexillographer/java.cs /root/src/foundationdb/fdbclient/vexillographer/python.cs /root/src/foundationdb/fdbclient/vexillographer/ruby.cs /root/src/foundationdb/fdbclient/vexillographer/vexillographer.cs -target:exe -out:/root/cbuild_output/vexillographer.exe
  DESC = Compile Vexillographer
  restat = 1
euskadi31 commented 9 months ago

Thanks @jzhou77, but it doesn't work, I'm on a Mac Studio M2, the docker image is only for amd64 :(

Error response from daemon: manifest for foundationdb/build:latest not found: manifest unknown: manifest unknown
Unable to find image 'foundationdb/build:latest' locally
docker: Error response from daemon: manifest for foundationdb/build:latest not found: manifest unknown: manifest unknown.

How do you go about developing layers in Go on macOS?

I find it really difficult to use the go client.

euskadi31 commented 9 months ago

I trying to generate ninja file:

mkdir build
cd build
cmake ../ -D USE_LD=LLD -D USE_WERROR=ON  -D USE_LIBCXX=1 -G Ninja
ninja
...
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
CMake Error at build/flowbench/googlebenchmark-src/CMakeLists.txt:283 (message):
  Failed to determine the source files for the regular expression backend

-- Configuring incomplete, errors occurred!
ninja: error: loading 'build.ninja': No such file or directory
Building generated files.
make -C /Users/euskadi31/Projects/poc/build/foundationdb bindings/c/foundationdb/fdb_c_options.g.h
make: *** No rule to make target `bindings/c/foundationdb/fdb_c_options.g.h'.  Stop.
Could not generate required c header