bashmakefileconfiguremongo-cxx-drivermongo-c-driver

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


I am trying to install mongo-c-driver there follow by http://mongoc.org/libmongoc/1.14.0/installing.html. Snce I don't have the root permission, I ran the following:

$ 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 

Where this error was shown:

-- 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.

So I tried to execute this:

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

which camp up with the error:

./configure: No such file or directory

The solutions that I found telling me to use ./autofen.sh or ./buildconf or autoreconf -i which yield errors as well ...


Solution

  • If you check the cmake file generated, you can see this block:

    $ 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}")
    

    So you need to define CMAKE_INSTALL_PREFIX when you build your cmake files.

    for example, instead of

    cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
    

    you need

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