whenever i try to build the mongocxx 4.0 driver using the instructions online on my debian 12 vm (works fine in ubuntu 22), it gives me the folllowing errors.
Please help. i have absolutely no idea why this wont work
user@debian:~/Downloads/mongo-cxx-driver-r4.0.0/build$ cmake … -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17
– No MongoDB C Driver path provided via CMAKE_PREFIX_PATH, will download C driver version 1.29.0 from the internet.
– Download and configure C driver version 1.29.0 … begin
[ 11%] Performing update step for ‘mongo-c-driver-populate’
CMake Error at /home/user/Downloads/mongo-cxx-driver-r4.0.0/build/_deps/mongo-c-driver-subbuild/mongo-c-driver-populate-prefix/tmp/mongo-c-driver-populate-gitupdate.cmake:25 (message):
Failed to get the hash for HEAD:
– Download and configure C driver version 1.29.0 … end
CMake Warning (dev) at CMakeLists.txt:207 (find_package):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run “cmake --help-policy CMP0148” for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
– Found PythonInterp: /usr/bin/python3.11 (found version “3.11.2”)
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File “/home/user/Downloads/mongo-cxx-driver-r4.0.0/etc/calc_release_version.py”, line 370, in
RELEASE_VER = main()
^^^^^^
File “/home/user/Downloads/mongo-cxx-driver-r4.0.0/etc/calc_release_version.py”, line 325, in main
head_commit_short = check_output([‘git’, ‘rev-parse’, ‘–revs-only’,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/user/Downloads/mongo-cxx-driver-r4.0.0/etc/calc_release_version.py”, line 131, in check_output
raise subprocess.CalledProcessError(ret, args[0])
subprocess.CalledProcessError: Command ‘git’ returned non-zero exit status 128.
CMake Error at CMakeLists.txt:220 (message):
BUILD_VERSION not specified and could not be calculated (script invocation
failed); specify in CMake command, -DBUILD_VERSION=
the error seems to be saying that there isnt a git repo. i can see the source code being downloaded properly into the _deps folder. so it shouldnt be me failing to download the source
If the build folder gets deleted from the tarball (which i was doing to clean the build between attempts), it will fail with the above error. Someone should probably modify the tarball and setup process so that this doesnt happen… since in basically every other situation, the build folder is entirely made up of generated files, and is therefore safe to delete for cleaning