Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5663

usleep was not declared in this scope

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • C++ - Library
    • None

    Description

      Several build failures in Travis resulted from an include-order problem in TFileTransport.cpp.

      libtool: compile:  g++ -std=c++11 -DHAVE_CONFIG_H -I/usr/include -I./src -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -Wextra -pedantic -g -O2 -MT src/thrift/transport/TFDTransport.lo -MD -MP -MF src/thrift/transport/.deps/TFDTransport.Tpo -c src/thrift/transport/TFDTransport.cpp -o src/thrift/transport/TFDTransport.o >/dev/null 2>&1
      libtool: compile:  g++ -std=c++11 -DHAVE_CONFIG_H -I/usr/include -I./src -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -Wextra -pedantic -g -O2 -MT src/thrift/transport/TFileTransport.lo -MD -MP -MF src/thrift/transport/.deps/TFileTransport.Tpo -c src/thrift/transport/TFileTransport.cpp  -fPIC -DPIC -o src/thrift/transport/.libs/TFileTransport.o
      In file included from ./src/thrift/Thrift.h:23:0,
                       from ./src/thrift/transport/TTransport.h:23,
                       from ./src/thrift/transport/TFileTransport.h:23,
                       from src/thrift/transport/TFileTransport.cpp:22:
      ./src/thrift/concurrency/FunctionRunner.h: In member function 'virtual void apache::thrift::concurrency::FunctionRunner::run()':
      ./src/thrift/transport/PlatformSocket.h:118:29: error: 'usleep' was not declared in this scope
       #  define THRIFT_SLEEP_USEC usleep
                                   ^
      ./src/thrift/concurrency/FunctionRunner.h:104:9: note: in expansion of macro 'THRIFT_SLEEP_USEC'
               THRIFT_SLEEP_USEC(intervalMs_ * 1000);
               ^~~~~~~~~~~~~~~~~
      ./src/thrift/transport/PlatformSocket.h:118:29: note: suggested alternative: 'fseek'
       #  define THRIFT_SLEEP_USEC usleep
                                   ^
      ./src/thrift/concurrency/FunctionRunner.h:104:9: note: in expansion of macro 'THRIFT_SLEEP_USEC'
               THRIFT_SLEEP_USEC(intervalMs_ * 1000);
               ^~~~~~~~~~~~~~~~~ 

      A cleaner solution would be better to simply include `<unistd.h>` in `PlatformSocket.h` but it's possible that might slow down compilation.

      The solution is just to include `<unistd.h>` before evaluating `THRIFT_SLEEP_USEC(intervalMs_ * 1000);`

      Attachments

        Issue Links

          Activity

            People

              cfriedt Christopher Friedt
              cfriedt Christopher Friedt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m