Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-77

Compiling issue involving timeval struct in mongo_conn_set_timeout

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 0.3
    • Component/s: None
    • Environment:
      Arch Linux kernel 2.6.39, gcc 4.6

      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>

        1. mongo.c
          33 kB
          Eric Hansen

            Assignee:
            kbanker Kyle Banker
            Reporter:
            raevin Eric Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: