【问题标题】:mongo c driver ./configure; no such file or directorymongo c 驱动程序 ./configure;无此文件或目录
【发布时间】:2020-11-13 04:26:12
【问题描述】:

我正在尝试在那里安装 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 也会产生错误...

【问题讨论】:

标签: bash makefile configure mongo-cxx-driver mongo-c-driver


【解决方案1】:

如果你检查生成的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 ..

【讨论】:

  • 但是以这种方式,当我编译 hello_mongo.c mongoc.org/libmongoc/1.14.0/tutorial.html 以通过 gcc -o hello_mongoc hello_mongoc.c \ -I/mypath/nclude/libbson-1.0 -I/mypath/include/libmongoc-1.0 \ -lmongoc-1.0 -lbson-1.0 进行测试时,它给了我错误 /usr/bin/ld: cannot find -lmongoc-1.0 /usr/bin/ld: cannot find -lbson-1.0 看起来我应该更改系统变量的路径或什么?
  • 我想是的。我会使用-I args 并尝试将其指向我的自定义文件夹。我已经 10 多年没有做过 c 了,所以我不确定需要改变什么。如果您找不到答案,请随时通过示例发布另一个问题(即您的 c 代码是什么样的),我相信有人能够指导您。
  • 我将链接路径添加到命令中,并将链接路径添加到可以工作的LD_LIBRARY_PATH,谢谢^^
猜你喜欢
  • 2020-08-07
  • 2021-12-26
  • 1970-01-01
  • 1970-01-01
  • 2020-06-20
  • 1970-01-01
  • 2011-10-05
相关资源
最近更新 更多