Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1412

Error building C++ driver: Can not find bson.h

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Community Answered
    • Affects Version/s: 3.1.2
    • Fix Version/s: None
    • Component/s: BSON, Build
    • Labels:
    • Environment:
      Ubuntu 16.04
      mongo-c-driver-1.6.3

      Description

      Hi,

      I have been trying to build 3.1.2 C++ Mongo DB driver on top of mongo-c-driver-1.6.3 but it fails on make when trying to find include bson.h it seems to be something related to libbson linking headers/library.

      I followed the steps from https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/ but failed on step 5.

      Here is what I have done so far:

      Step 1: Install the latest version of the MongoDB C driver.
      wget https://github.com/mongodb/mongo-c-driver/releases/download/1.6.3/mongo-c-driver-1.6.3.tar.gz
      tar xzf mongo-c-driver-1.6.3.tar.gz
      cd mongo-c-driver-1.6.3
      ./configure --disable-automatic-init-and-cleanup --prefix=/usr/local --libdir=/usr/lib64 --with-libbson=bundled
      make
      make install

      Step 2: Choose a C++17 polyfill
      -DBSONCXX_POLY_USE_MNMLSTC=1

      Step 3: Download the latest version of the mongocxx driver.
      cd ~
      curl -OL https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.2.tar.gz
      tar -xzf r3.1.2.tar.gz
      cd mongo-cxx-driver-r3.1.2/build

      Step 4: Configure the driver
      sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. -DBSONCXX_POLY_USE_MNMLSTC=1 -DLIBMONGOC_DIR=/usr/lib64 -DLIBBSON_DIR=/usr/lib64

      -- The CXX compiler identification is GNU 5.4.0
      -- Check for working CXX compiler: /usr/bin/c++
      -- Check for working CXX compiler: /usr/bin/c++ -- works
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- The C compiler identification is GNU 5.4.0
      -- Check for working C compiler: /usr/bin/cc
      -- Check for working C compiler: /usr/bin/cc -- works
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Found LIBBSON: bson-1.0
      -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
      -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
      -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
      -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
      -- Performing Test COMPILER_HAS_DEPRECATED_ATTR
      -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
      -- Found LIBMONGOC: mongoc-1.0
      -- Configuring done
      -- Generating done
      -- Build files have been written to: $HOME/mongo-cxx-driver-r3.1.2/build
      

      Step 5: Build and install the driver
      sudo make EP_mnmlstc_core

      Scanning dependencies of target EP_mnmlstc_core
      [  0%] Creating directories for 'EP_mnmlstc_core'
      [ 50%] Performing download step (git clone) for 'EP_mnmlstc_core'
      -- EP_mnmlstc_core download command succeeded.  See also $HOME/mongo-cxx-driver-r3.1.2/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-download-*.log
      [ 50%] No patch step for 'EP_mnmlstc_core'
      [ 50%] No update step for 'EP_mnmlstc_core'
      [100%] Performing configure step for 'EP_mnmlstc_core'
      -- EP_mnmlstc_core configure command succeeded.  See also $HOME/mongo-cxx-driver-r3.1.2/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-configure-*.log
      [100%] Performing build step for 'EP_mnmlstc_core'
      -- EP_mnmlstc_core build command succeeded.  See also $HOME/mongo-cxx-driver-r3.1.2/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-build-*.log
      [100%] Performing install step for 'EP_mnmlstc_core'
      -- EP_mnmlstc_core install command succeeded.  See also$HOME/mongo-cxx-driver-r3.1.2/build/src/bsoncxx/third_party/EP_mnmlstc_core-prefix/src/EP_mnmlstc_core-stamp/EP_mnmlstc_core-install-*.log
      [100%] Performing fix-includes step for 'EP_mnmlstc_core'
      [100%] Completed 'EP_mnmlstc_core'
      [100%] Built target EP_mnmlstc_core
      

      sudo make

      [  2%] Built target EP_mnmlstc_core
      Scanning dependencies of target bsoncxx_static
      [  2%] Building CXX object src/bsoncxx/CMakeFiles/bsoncxx_static.dir/array/element.cpp.o
      [  2%] Building CXX object src/bsoncxx/CMakeFiles/bsoncxx_static.dir/array/value.cpp.o
      [  3%] Building CXX object src/bsoncxx/CMakeFiles/bsoncxx_static.dir/array/view.cpp.o
      $HOME/mongo-cxx-driver-r3.1.2/src/bsoncxx/array/view.cpp:21:18: fatal error: bson.h: No such file or directory
      compilation terminated.
      src/bsoncxx/CMakeFiles/bsoncxx_static.dir/build.make:110: recipe for target 'src/bsoncxx/CMakeFiles/bsoncxx_static.dir/array/view.cpp.o' failed
      make[2]: *** [src/bsoncxx/CMakeFiles/bsoncxx_static.dir/array/view.cpp.o] Error 1
      CMakeFiles/Makefile2:437: recipe for target 'src/bsoncxx/CMakeFiles/bsoncxx_static.dir/all' failed
      make[1]: *** [src/bsoncxx/CMakeFiles/bsoncxx_static.dir/all] Error 2
      Makefile:138: recipe for target 'all' failed
      make: *** [all] Error 2
      

      What should I do to point bson library to be aware of where should it go to find the header bson.h?

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            gsuades Gerard
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: