[ 
https://issues.apache.org/jira/browse/THRIFT-5663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christopher Friedt updated THRIFT-5663:
---------------------------------------
    Description: 
Several build failures in Travis resulted from an include-order problem in 
TFileTransport.cpp.


{code:java}
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);
         ^~~~~~~~~~~~~~~~~ {code}

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);`

  was:
Travis builds are seeing multiple failures of this form:
{code:java}
src/thrift/transport/TFileTransport.cpp  -fPIC -DPIC -o 
src/thrift/transport/.libs/TFileTransport.o1516In file included from 
./src/thrift/Thrift.h:23:0,1517                 from 
./src/thrift/transport/TTransport.h:23,1518                 from 
./src/thrift/transport/TFileTransport.h:23,1519                 from 
src/thrift/transport/TFileTransport.cpp:22:1520./src/thrift/concurrency/FunctionRunner.h:
 In member function 'virtual void 
apache::thrift::concurrency::FunctionRunner::run()':1521./src/thrift/transport/PlatformSocket.h:118:29:
 error: 'usleep' was not declared in this scope1522 #  define THRIFT_SLEEP_USEC 
usleep1523                             
^1524./src/thrift/concurrency/FunctionRunner.h:104:9: note: in expansion of 
macro 'THRIFT_SLEEP_USEC'1525         THRIFT_SLEEP_USEC(intervalMs_ * 
1000);1526         
^~~~~~~~~~~~~~~~~1527./src/thrift/transport/PlatformSocket.h:118:29: note: 
suggested alternative: 'fseek'1528 #  define THRIFT_SLEEP_USEC usleep1529       
                      ^1530./src/thrift/concurrency/FunctionRunner.h:104:9: 
note: in expansion of macro 'THRIFT_SLEEP_USEC'1531         
THRIFT_SLEEP_USEC(intervalMs_ * 1000);1532         ^~~~~~~~~~~~~~~~~ {code}


> lib: cpp: usleep was not declared in this scope
> -----------------------------------------------
>
>                 Key: THRIFT-5663
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5663
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>            Reporter: Christopher Friedt
>            Assignee: Christopher Friedt
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Several build failures in Travis resulted from an include-order problem in 
> TFileTransport.cpp.
> {code:java}
> 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);
>          ^~~~~~~~~~~~~~~~~ {code}
> 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);`



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to