美文网首页
windows下安装mongodb驱动

windows下安装mongodb驱动

作者: 草丛里的黄盖 | 来源:发表于2020-09-24 10:11 被阅读0次

    本文章仅作为个人笔记

    解压下载的相关文件

    msys2安装

    • msys2下载下来是个可执行文件 打开
    • 一直下一步即可
    • 安装完打开 MingGW64 运行
        pacman --noconfirm -Syu
        pacman --noconfirm -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
        pacman --noconfirm -S mingw-w64-x86_64-extra-cmake-modules make tar
        pacman --noconfirm -S mingw64/mingw-w64-x86_64-cyrus-sasl
        pacman --noconfirm -S git
    

    libbson安装

    • 下载对应版本的tar.gz文件并解压
        tar -zxvf libbson-1.9.5.tar.gz
        cd libbson-1.9.5
        mkdir cmake-build
        cd cmake-build
        CC=/mingw64/bin/gcc.exe /mingw64/bin/cmake -fPIC -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="/D/Develop/mongo/libbson" -DCMAKE_C_FLAGS="-D__USE_MINGW_ANSI_STDIO=1" ..
        make install
    

    mongo-c-driver安装

    • 下载对应版本的tar.gz文件并解压
        tar -zxvf mongo-c-driver-1.16.2.tar.gz
        cd mongo-c-driver-1.16.2
        mkdir cmake-build
        cd cmake-build
        CC=/mingw64/bin/gcc.exe /mingw64/bin/cmake -fPIC -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="/D/Develop/mongo/mongocdriver" -DCMAKE_PREFIX_PATH="/D/Develop/mongo/libbson" -DCMAKE_C_FLAGS="-D__USE_MINGW_ANSI_STDIO=1" ..
        make install
    

    mongo-cxx-driver安装

    • 下载对应版本的tar.gz文件并解压
        tar -zxvf r3.4.2.tar.gz
        cd mongo-cxx-driver-r3.4.2/build
        CC=/mingw64/bin/gcc.exe /mingw64/bin/cmake -fPIC -G "MSYS Makefiles" -DBUILD_SHARED_LIBS_WITH_STATIC_MONGOC=ON -DCMAKE_INSTALL_PREFIX="/D/Develop/mongo/mongocxxdriver" -DCMAKE_PREFIX_PATH="D:\Develop\mongo\mongocdriver" -DCMAKE_C_FLAGS="-D__USE_MINGW_ANSI_STDIO=1" ..
        make install
    

    添加环境变量

        libbsoncxx_DIR
        D:\Develop\mongo\mongocxxdriver\lib\cmake\libbsoncxx-3.4.2
        libmongocxx_DIR
        D:\Develop\mongo\mongocxxdriver\lib\cmake\libmongocxx-3.4.2
        LIBBSONCXX_LIBRARIES
        D:\Develop\mongo\mongocxxdriver\lib
        LIBBSONCXX_LIBRARIES
        D:\Develop\mongo\mongocxxdriver\lib
    

    相关文章

      网友评论

          本文标题:windows下安装mongodb驱动

          本文链接:https://www.haomeiwen.com/subject/kslzyktx.html