博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MongoDB C Driver Building on CentOS
阅读量:6205 次
发布时间:2019-06-21

本文共 2250 字,大约阅读时间需要 7 分钟。

Building on Unix

Prerequisites

OpenSSL is required for authentication or for SSL connections to MongoDB. Kerberos or LDAP support requires Cyrus SASL.

To install all optional dependencies on RedHat / Fedora:$ sudo yum install pkg-config openssl-devel cyrus-sasl-develOn Debian / Ubuntu:$ sudo apt-get install pkg-config libssl-dev libsasl2-devOn FreeBSD:$ su -c 'pkg install pkgconf openssl cyrus-sasl'

Building from a release tarball

Unless you intend on contributing to the mongo-c-driver, you will want to build from a release tarball.

The most recent release of libmongoc is 1.8.1 and can be . The following snippet will download and extract the driver, and configure it:

$ wget https://github.com/mongodb/mongo-c-driver/releases/download/1.8.1/mongo-c-driver-1.8.1.tar.gz$ tar xzf mongo-c-driver-1.8.1.tar.gz$ cd mongo-c-driver-1.8.1$ ./configure --disable-automatic-init-and-cleanup 

亲测:

这个地址下载超慢 

 

所以还是从 git 下载源码

Building from git

To build an unreleased version of the driver from git requires additional dependencies.

RedHat / Fedora:$ sudo yum install git gcc automake autoconf libtoolDebian / Ubuntu:$ sudo apt-get install git gcc automake autoconf libtoolFreeBSD:$ su -c 'pkg install git gcc automake autoconf libtool'

Once you have the dependencies installed, clone the repository and build the current master or a particular release tag:

$ git clone https://github.com/mongodb/mongo-c-driver.git$ cd mongo-c-driver$ git checkout x.y.z  # To build a particular release$ ./autogen.sh --with-libbson=bundled$ make$ sudo make install

1.

  下载 mongo-c-driver-r1.6 源码:

    (GitHub驱动源码,这个 src/libbson 文件夹里面是空的,要单独下载)

  下载 libbson-r1.6 源码:

     

2.

  解压:

    unzip mongo-c-driver-r1.6.zip

    unzip libbson-r1.6.zip

3.

  将 libbson 源码 拷贝 至 mongo-c-driver-r1.6/src/libbson 目录

4. 

  sudo yum install pkg-config openssl-devel cyrus-sasl-devel

  ./autogen.sh --with-libbson=bundled (得先安装 libtoll ,否则会报错。sudo yum install libtool*)

  make

  sudo make install

安装完成的库和头文件目录:

  /usr/local/lib

  /usr/local/include

  

  

API 用法详见:

注意:

  使用库的时候报错:

    error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

原因:

  程序按照默认共享库路径找不到该共享库文件。

解决方法:

  详见:

 

转载于:https://www.cnblogs.com/SZxiaochun/p/7685469.html

你可能感兴趣的文章
指尖上的代码[C语言版]-<1>
查看>>
二叉树的线索
查看>>
Oracle参考<二>
查看>>
NYOJ 35
查看>>
SPOJ 1693 Coconuts
查看>>
java IO 流的学习(我们到底能走多远系列1)
查看>>
Linux Socket学习--域和地址族
查看>>
Objective-C调用C++代码
查看>>
ActivityManager
查看>>
推荐3款热门特惠(幻灯、WP插件、主题等等)
查看>>
HDU 4122 Alice's mooncake shop(RMQ,或者单调队列)
查看>>
对makefile 中的 静态模式规则的理解
查看>>
关于我的几个博客
查看>>
分享精心收藏的60套精美的日历PSD源文件
查看>>
MongoVUE的使用
查看>>
mysql基本语句
查看>>
box2d 刚体的重心设置
查看>>
HDU 1073 Online Judge (字符串处理,简单题)
查看>>
Windows8离线安装.net framework 3.5
查看>>
C#数据结构与算法揭秘十
查看>>