bsontools: unable to compile project

114 views
Skip to first unread message

joshua bacher

unread,
Mar 9, 2016, 11:04:01 AM3/9/16
to BSON

Hi,

can you tell me what concrete i am missing to compile bsontools?


❯ cat /etc/issue
Ubuntu 15.10 \n \l

❯ uname -a
Linux hostname 4.2.0-30-generic #35-Ubuntu SMP Fri Feb 19 13:52:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

❯ dpkg -l | grep gcc
ii gcc 4:5.2.1-3ubuntu1 amd64 GNU C compiler
ii gcc-4.9 4.9.3-5ubuntu1 amd64 GNU C compiler
ii gcc-4.9-base:amd64 4.9.3-5ubuntu1 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-5 5.2.1-22ubuntu2 amd64 GNU C compiler
ii gcc-5-base:amd64 5.2.1-22ubuntu2 amd64 GCC, the GNU Compiler Collection (base package)
ii gcc-5-base:i386 5.2.1-22ubuntu2 i386 GCC, the GNU Compiler Collection (base package)
ii gcc-5-source 5.2.1-22ubuntu2 all Source of the GNU Compiler Collection
**... and many other things

❯ git clone -s https://github.com/dwight/bson-cxx.git

❯ git clone -s https://github.com/dwight/bsontools.git

❯ ls
bson-cxx bsontools

❯ cd bsontools
❯ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o /var/tmp/build-tmp/bson-cxx/src/bson/time_support.o -c -std=c++0x /var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp
In file included from /var/tmp/build-tmp/bson-cxx/src/bson/builder.h:27:0,
from /var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:24:
/var/tmp/build-tmp/bson-cxx/src/bson/endian.h:10:32: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
#pragma GCC diagnostic ignored "-Wstring-compare"
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:321:18: error: 'std::tm' has not been declared
std::tm* resultTm) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp: In function '_bson::Status _bson::parseTmFromTokens(const _bson::StringData&, const _bson::StringData&, const _bson::StringData&, const _bson::StringData&, const _bson::StringData&, const _bson::StringData&, int)':
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:332:79: error: request for member 'tm_year' in '
resultTm', which is of non-class type 'int'
Status status = parseNumberFromStringWithBase(yearStr, 10, &resultTm->tm_year);
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:337:23: error: request for member 'tm_year' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_year < 1970 || resultTm->tm_year > 9999) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:337:51: error: request for member 'tm_year' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_year < 1970 || resultTm->tm_year > 9999) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:339:55: error: request for member 'tm_year' in '* resultTm', which is of non-class type 'int'
sb << "Year out of range: " << resultTm->tm_year;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:343:19: error: request for member 'tm_year' in '* resultTm', which is of non-class type 'int'
resultTm->tm_year -= 1900;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:352:73: error: request for member 'tm_mon' in '* resultTm', which is of non-class type 'int'
status = parseNumberFromStringWithBase(monthStr, 10, &resultTm->tm_mon);
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:357:23: error: request for member 'tm_mon' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_mon < 1 || resultTm->tm_mon > 12) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:357:47: error: request for member 'tm_mon' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_mon < 1 || resultTm->tm_mon > 12) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:359:56: error: request for member 'tm_mon' in '* resultTm', which is of non-class type 'int'
sb << "Month out of range: " << resultTm->tm_mon;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:363:19: error: request for member 'tm_mon' in '* resultTm', which is of non-class type 'int'
resultTm->tm_mon -= 1;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:372:71: error: request for member 'tm_mday' in '* resultTm', which is of non-class type 'int'
status = parseNumberFromStringWithBase(dayStr, 10, &resultTm->tm_mday);
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:377:23: error: request for member 'tm_mday' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_mday < 1 || resultTm->tm_mday > 31) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:377:48: error: request for member 'tm_mday' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_mday < 1 || resultTm->tm_mday > 31) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:379:54: error: request for member 'tm_mday' in '* resultTm', which is of non-class type 'int'
sb << "Day out of range: " << resultTm->tm_mday;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:390:72: error: request for member 'tm_hour' in '* resultTm', which is of non-class type 'int'
status = parseNumberFromStringWithBase(hourStr, 10, &resultTm->tm_hour);
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:395:23: error: request for member 'tm_hour' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_hour < 0 || resultTm->tm_hour > 23) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:395:48: error: request for member 'tm_hour' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_hour < 0 || resultTm->tm_hour > 23) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:397:55: error: request for member 'tm_hour' in '* resultTm', which is of non-class type 'int'
sb << "Hour out of range: " << resultTm->tm_hour;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:408:71: error: request for member 'tm_min' in '* resultTm', which is of non-class type 'int'
status = parseNumberFromStringWithBase(minStr, 10, &resultTm->tm_min);
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:413:23: error: request for member 'tm_min' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_min < 0 || resultTm->tm_min > 59) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:413:47: error: request for member 'tm_min' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_min < 0 || resultTm->tm_min > 59) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:415:57: error: request for member 'tm_min' in '* resultTm', which is of non-class type 'int'
sb << "Minute out of range: " << resultTm->tm_min;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:430:71: error: request for member 'tm_sec' in '* resultTm', which is of non-class type 'int'
status = parseNumberFromStringWithBase(secStr, 10, &resultTm->tm_sec);
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:435:23: error: request for member 'tm_sec' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_sec < 0 || resultTm->tm_sec > 59) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:435:47: error: request for member 'tm_sec' in '* resultTm', which is of non-class type 'int'
if (resultTm->tm_sec < 0 || resultTm->tm_sec > 59) {
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:437:57: error: request for member 'tm_sec' in '* resultTm', which is of non-class type 'int'
sb << "Second out of range: " << resultTm->tm_sec;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp: At global scope:
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:445:25: error: 'std::tm' has not been declared
std::tm* resultTm,
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp: In function '_bson::StatusWith<_bson::Date_t> _bson::dateFromISOString(const _bson::StringData&)':
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:539:9: error: 'tm' is not a member of 'std'
std::tm theTime;
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:539:9: note: suggested alternative:
In file included from /usr/include/pthread.h:24:0,
from /usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h:148,
from /usr/include/c++/5/ext/atomicity.h:35,
from /usr/include/c++/5/bits/basic_string.h:39,
from /usr/include/c++/5/string:52,
from /var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:16:
/usr/include/time.h:133:8: note: 'tm'
struct tm
^
/var/tmp/build-tmp/bson-cxx/src/bson/time_support.cpp:542:46: error: 'theTime' was not declared in this scope
Status status = parseTm(dateString, &theTime, &millis, &tzAdjSecs);
^
scons: *** [/var/tmp/build-tmp/bson-cxx/src/bson/time_support.o] Error 1
scons: building terminated because of errors.

Erez Sh

unread,
May 21, 2016, 7:56:24 PM5/21/16
to BSON
I have the exact same error. Fedora 23, fresh installation.

José Luis Vidal

unread,
Sep 21, 2016, 6:23:35 PM9/21/16
to BSON
std:tm is defined in <ctime>, but <ctime> is not included in bson-cxx/src/bson/time_support.cpp.
I added #include <ctime> there and could compile the bsontools binaries afterwards.

Dwight Merriman

unread,
Sep 27, 2016, 9:49:23 AM9/27/16
to BSON
i will look into it.  and probably make a change in the repo per your suggestion.  i'm guessing that some gcc versions are pulling in std::tm from other headers but maybe that has changed.  Erez, does adding the include work for you?

Dwight Merriman

unread,
Sep 27, 2016, 10:33:22 AM9/27/16
to BSON
i added the include , should be in the repo now, and did a little cleaning lmk if it works, and/or if i broke anything.
thanks
Reply all
Reply to author
Forward
0 new messages