[CDRIVER-77] Compiling issue involving timeval struct in mongo_conn_set_timeout Created: 30/Jun/11  Updated: 03/May/17  Resolved: 30/Jun/11

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 0.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Eric Hansen Assignee: Kyle Banker
Resolution: Done Votes: 0
Labels: compile, error, time.h, timeout
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Arch Linux kernel 2.6.39, gcc 4.6


Attachments: File mongo.c    

 Description   

When compiling the mongoDB C driver, I get this message:

scons --c99
scons: Reading SConscript files ...
Checking for C library json... no
scons: done reading SConscript files.
scons: Building targets ...
gcc -o src/md5.o -c -std=c99 -pedantic -Wall -ggdb -DMONGO_HAVE_STDINT -O3 -I/opt/local/include -Isrc src/md5.c
gcc -o src/mongo.o -c -std=c99 -pedantic -Wall -ggdb -DMONGO_HAVE_STDINT -O3 -I/opt/local/include -Isrc src/mongo.c
src/mongo.c: In function 'mongo_conn_set_timeout':
src/mongo.c:437:20: error: storage size of 'tv' isn't known
src/mongo.c:437:20: warning: unused variable 'tv' [-Wunused-variable]

The reason for this is that "struct timeval tv" is not defined by default. <sys/time.h> is not included in mongo.c, and thus causes the compiling process to terminate with the above error. Attached is a modified version of mongo.c that has two lines, a comment line and #include <sys/time.h>



 Comments   
Comment by Kyle Banker [ 30/Jun/11 ]

Thanks for the report.

We do recommend building from a given tag. Master should be considered unstable.

Comment by auto [ 30/Jun/11 ]

Author:

{u'login': u'banker', u'name': u'Kyle Banker', u'email': u'kylebanker@gmail.com'}

Message: CDRIVER-77 minor: include time.h
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/f27c6580839d5a149ac1916b01d2937f889636e3

Generated at Wed Feb 07 21:08:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.