我正在尝试安装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,它们也会产生错误……
发布于 2020-07-23 22:23:55
如果你检查生成的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 ..https://stackoverflow.com/questions/63054346
复制相似问题