bson-cpp icon indicating copy to clipboard operation
bson-cpp copied to clipboard

OSX Compilation Error

Open ghost opened this issue 13 years ago • 4 comments

In file included from src/bsonobj.cpp:21: src/bsonobj.h:24:29: error: util/atomic_int.h: No such file or directory In file included from src/util/../bsonassert.h:40, from src/util/hex.h:20, from src/oid.h:20, from src/bsonobj.cpp:20: src/util/../util/builder.h: In member function 'void bson::StringBuilder::appendDoubleNice(double)': src/util/../util/builder.h:277: error: 'assert' was not declared in this scope src/util/../util/builder.h: In member function 'bson::StringBuilder& bson::StringBuilder::SBNUM(T, int, const char_)': src/util/../util/builder.h:313: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available src/util/../util/builder.h:313: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) In file included from src/bsonobj.h:27, from src/bsonobj.cpp:21: src/bsonelement.h: At global scope: src/bsonelement.h:73: error: 'mongo' has not been declared src/bsonelement.h:73: error: ISO C++ forbids declaration of 'OID' with no type src/bsonelement.h:73: error: expected ';' before 'OID' src/bsonelement.h:74: error: expected `;' before 'void' In file included from src/bsonobj.cpp:21: src/bsonobj.h:93: error: expected ',' or '...' before '' token src/bsonobj.h:93: error: ISO C++ forbids declaration of 'Record' with no type src/bsonobj.h:456: error: 'AtomicUInt' does not name a type src/bsonobj.h: In member function 'void bson::BSONObj::Holder::zero()': src/bsonobj.h:460: error: 'refCount' was not declared in this scope src/bsonobj.h: In function 'void bson::intrusive_ptr_add_ref(bson::BSONObj::Holder)': src/bsonobj.h:463: error: 'class bson::BSONObj::Holder' has no member named 'refCount' src/bsonobj.h: In function 'void bson::intrusive_ptr_release(bson::BSONObj::Holder_)': src/bsonobj.h:468: error: 'class bson::BSONObj::Holder' has no member named 'refCount' In file included from src/util/../bson.h:42, from src/util/json.h:21, from src/bsonobj.cpp:27: src/util/../bson-inl.h: In member function 'int bson::BSONElement::size() const': src/util/../bson-inl.h:634: error: 'Bool' is not a member of 'mongo' src/util/../bson-inl.h:641: error: 'Date' is not a member of 'mongo' src/util/../bson-inl.h:651: error: 'String' is not a member of 'mongo' src/util/../bson-inl.h:659: error: 'Array' is not a member of 'mongo' src/bsonobj.cpp: At global scope: src/bsonobj.cpp:448: error: redefinition of 'int bson::BSONElement::woCompare(const bson::BSONElement&, bool) const' src/util/../bson-inl.h:156: error: 'int bson::BSONElement::woCompare(const bson::BSONElement&, bool) const' previously defined here src/bsonobj.cpp: In function 'int bson::compareElementValues(const bson::BSONElement&, const bson::BSONElement&)': src/bsonobj.cpp:465: error: redefinition of 'int bson::compareElementValues(const bson::BSONElement&, const bson::BSONElement&)' src/util/../bson-inl.h:38: error: 'int bson::compareElementValues(const bson::BSONElement&, const bson::BSONElement&)' previously defined here src/bsonobj.cpp: At global scope: src/bsonobj.cpp:812: error: prototype for 'void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&) const' does not match any in class 'bson::BSONObj' src/bsonobj.h:190: error: candidates are: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementMSet&, bool) const src/bsonobj.h:189: error: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&, bool) const src/bsonobj.cpp: In member function 'void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&) const': src/bsonobj.cpp:822: error: call of overloaded 'getFieldsDotted(const char_&, std::set<bson::BSONElement, bson::BSONElementCmpWithoutField, std::allocatorbson::BSONElement >&)' is ambiguous src/bsonobj.h:189: note: candidates are: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&, bool) const src/bsonobj.cpp:812: note: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&) const src/bsonobj.cpp:833: error: call of overloaded 'getFieldsDotted(const char_&, std::set<bson::BSONElement, bson::BSONElementCmpWithoutField, std::allocatorbson::BSONElement >&)' is ambiguous src/bsonobj.h:189: note: candidates are: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&, bool) const src/bsonobj.cpp:812: note: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&) const src/bsonobj.cpp:840: error: call of overloaded 'getFieldsDotted(const char_&, std::set<bson::BSONElement, bson::BSONElementCmpWithoutField, std::allocatorbson::BSONElement >&)' is ambiguous src/bsonobj.h:189: note: candidates are: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&, bool) const src/bsonobj.cpp:812: note: void bson::BSONObj::getFieldsDotted(const bson::StringData&, bson::BSONElementSet&) const src/bsonobj.cpp: At global scope: src/bsonobj.cpp:963: error: redefinition of 'int bson::BSONObj::getIntField(const char_) const' src/util/../bson-inl.h:276: error: 'int bson::BSONObj::getIntField(const char_) const' previously defined here src/bsonobj.cpp:968: error: redefinition of 'bool bson::BSONObj::getBoolField(const char_) const' src/util/../bson-inl.h:281: error: 'bool bson::BSONObj::getBoolField(const char_) const' previously defined here src/bsonobj.cpp:973: error: redefinition of 'const char_ bson::BSONObj::getStringField(const char_) const' src/util/../bson-inl.h:286: error: 'const char_ bson::BSONObj::getStringField(const char_) const' previously defined here src/bsonobj.cpp: In member function 'int bson::BSONObj::addFields(bson::BSONObj&, std::set<std::basic_string<char, std::char_traits, std::allocator >, std::less<std::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::basic_string<char, std::char_traits, std::allocator > > >&)': src/bsonobj.cpp:1024: error: no matching function for call to 'bson::BSONObj::init(char_, bool)' src/bsonobj.h:481: note: candidates are: void bson::BSONObj::init(bson::BSONObj::Holder_) src/bsonobj.h:485: note: void bson::BSONObj::init(const char_) make[1]: *** [libbsoncpp_la-bsonobj.lo] Error 1 make: *** [all] Error 2

ghost avatar Jun 27 '11 20:06 ghost

Hey MacDeveloper,

I fixed the compilation error. I'd forgotten to commit and push a final edit when i merged in upstream changes. It builds and passes the tests now (run them with make test). Please pull and close the issue if this solved it for you.

Just as a warning, this repo is a bit experimental, as I just forked it out of mongodb. I'm not sure it's production ready yet.

Thanks for posting this issue! Cheers.

jbenet avatar Jun 28 '11 07:06 jbenet

i have tested but it doesn't compile yet checking boost/filesystem/path.hpp usability... no checking boost/filesystem/path.hpp presence... yes configure: WARNING: boost/filesystem/path.hpp: present but cannot be compiled configure: WARNING: boost/filesystem/path.hpp: check for missing prerequisite headers? configure: WARNING: boost/filesystem/path.hpp: see the Autoconf documentation configure: WARNING: boost/filesystem/path.hpp: section "Present But Cannot Be Compiled" configure: WARNING: boost/filesystem/path.hpp: proceeding with the compiler's result configure: WARNING: ## ------------------------------------- ## configure: WARNING: ## Report this to [email protected] ## configure: WARNING: ## ------------------------------------- ## checking for boost/filesystem/path.hpp... no configure: error: cannot find boost/filesystem/path.hpp make[1]: *** [configure] Error 1 make: *** [all] Error 2

this is the boost path on my mac "/usr/local/include/boost/filesystem/path.hp" can be an error on how i have compiled boost?

ghost avatar Jun 28 '11 08:06 ghost

That's the same path I have boost in.

From the "present but cannot be compiled" line, I'm guessing that boost can be found ok, but your toolchain may not be setup properly.

Question: do you have the GNU binutils installed? (Like, not the stock apple GCC but actually installed the binutils distribution through mac ports, brew, or otherwise?)

Thanks for reporting these, by the way!

jbenet avatar Jun 30 '11 16:06 jbenet

the problem is that it check for "ld: library not found for -lboost_system-mt" -mt variant i have compiled boost on my osx system but in default mode boost compile without -mt. no problem for the help. I like to help source code project if i can. And i wish to tank you for make this project that is very useful.

ghost avatar Jun 30 '11 17:06 ghost