我正在尝试在那里安装mongo-c驱动程序http://mongoc.org/libmongoc/1.14.0/installing.html.Snce我没有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 ..