mongo c驱动程序./configure;无此文件或目录

mongo c driver ./configure; no such file or directory

我正在尝试安装 mongo-c-driver,然后安装 http://mongoc.org/libmongoc/1.14.0/installing.html。由于我没有root权限,我运行以下:

$ wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.0-rc0/mongo-c-driver-1.17.0-rc0.tar.gz
$ tar xzf mongo-c-driver-1.17.0-rc0.tar.gz
$ cd mongo-c-driver-1.17.0-rc0
$ mkdir cmake-build
$ cd cmake-build
$ cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
$ make 
$ make install 

显示此错误的位置:

-- Install configuration: "RelWithDebInfo"
CMake Error at cmake_install.cmake:46 (file):
  file cannot create directory: /usr/local/share/mongo-c-driver.  Maybe need
  administrative privileges.

所以我试着执行这个:

./configure --prefix=/home/mypath/mongo-c-driver

哪个阵营出现错误:

./configure: No such file or directory

我发现的解决方案告诉我使用 ./autofen.sh ./buildconf autoreconf -i 也会产生错误...

如果你检查生成的cmake文件,你可以看到这个块:

$ head cmake_install.cmake
# Install script for directory: /home/mhristof/mongo-c-driver-1.17.0-rc0

# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
  set(CMAKE_INSTALL_PREFIX "/home/mhristof/mongo-c-driver-1.17.0-rc0/cmakestuff/foobar")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

因此您需要在构建 cmake 文件时定义 CMAKE_INSTALL_PREFIX

例如,而不是

cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..

你需要

cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DCMAKE_INSTALL_PREFIX=$PWD/foobar ..