Skip to content

Broken imports #362

Description

@zoonman

Include fails to import mongodb driver.

Description

I am unable to run or compile the project.

Expected Behavior

The project should run flawlessly.

Actual Behavior

 buck run :app
Using additional configuration options from .buckconfig.d/.buckconfig.buckaroo
Action graph will be rebuilt because files have been added or removed.
main.cpp:2:10: fatal error: 'bsoncxx/builder/stream/document.hpp' file not found
#include <bsoncxx/builder/stream/document.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Building: finished in 0.5 sec (100%) 79/80 jobs, 2 updated
  Total time: 0.7 sec
Command failed with exit code 1.

command: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++, @/Users/zoonman/Projects/cpp/pe/buck-out/bin/app#compile-main.cpp.oa5b6a1ba,macosx-x86_64/ppandcompile.argsfile]

stderr: main.cpp:2:10: fatal error: 'bsoncxx/builder/stream/document.hpp' file not found
#include <bsoncxx/builder/stream/document.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
    When running <c++ preprocess_and_compile>.
    When building rule //:app#compile-main.cpp.oa5b6a1ba,macosx-x86_64.

Possible Fix

Steps to Reproduce

  1. buckaroo quickstart
  2. buckaroo add github.com/buckaroo-pm/mongo-cxx-driver
  3. Add to main.cpp
#include <iostream>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>

#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>

int main() {
    std::cout << "Hello, world. " << std::endl;


    mongocxx::instance inst{};
    mongocxx::client conn{mongocxx::uri{}};

    bsoncxx::builder::stream::document document{};

    auto collection = conn["testdb"]["testcollection"];
    document << "hello" << "world";

    collection.insert_one(document.view());
    auto cursor = collection.find({});

    for (auto&& doc : cursor) {
        std::cout << bsoncxx::to_json(doc) << std::endl;
    }

  return 0; 
}
  1. buck run :app

Context

I am trying to build my first application using PM for C++ code.
I have used npm, composer, bundler in the past and had no problems.

Your Environment

buckaroo version
2.2.0

buck --version
buck version 83546bc988fa848c1c2418a43395cbb09a864acd

uname -a
Darwin zmMac.local 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec  1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64

macOS Mojave v10.14.6 (18G2022)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions