[ 
https://issues.apache.org/jira/browse/THRIFT-3497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15066814#comment-15066814
 ] 

ASF GitHub Bot commented on THRIFT-3497:
----------------------------------------

GitHub user simonsouth opened a pull request:

    https://github.com/apache/thrift/pull/753

    THRIFT-3497 Build fails with "invalid use of incomplete type"

    This change fixes an "invalid use of incomplete type" compiler error 
referring to `struct timeval` when building on Haiku.
    
    - `Monitor.cpp`: Include `thrift-config.h` for definition of 
`HAVE_SYS_TIME_H`.
    - `Monitor.h`: Explicitly include `sys/time.h` on platforms that require 
this.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/simonsouth/thrift 
thrift-3497-build-fails-with-invalid-use

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/753.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #753
    
----
commit fc8607d5379a48cf3a5e517a4d32e8faa9a9fdea
Author: Simon South <[email protected]>
Date:   2015-12-21T18:01:03Z

    THRIFT-3497 Build fails with "invalid use of incomplete type"
    
    - Monitor.cpp: Include thrift-config.h for definition of
      HAVE_SYS_TIME_H
    - Monitor.h: Explicitly include sys/time.h on platforms that require
      this

----


> Build fails with "invalid use of incomplete type"
> -------------------------------------------------
>
>                 Key: THRIFT-3497
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3497
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9.4
>         Environment: gcc 4.8.5 on Haiku hrev49934 (x86)
>            Reporter: Simon South
>            Assignee: Simon South
>            Priority: Minor
>              Labels: c++, haiku, library
>
> Building the latest code in git on [Haiku|http://haiku-os.org/] fails with a 
> number of error messages like
> {noformat}
> In file included from src/thrift/concurrency/Monitor.cpp:22:0:
> ./src/thrift/concurrency/Util.h: In static member function 'static void 
> apache::thrift::concurrency::Util::toTimeval(apache::thrift::concurrency::timeval&,
>  int64_t)':
> ./src/thrift/concurrency/Util.h:73:11: error: invalid use of incomplete type 
> 'struct apache::thrift::concurrency::timeval'
>      result.tv_sec = static_cast<uint32_t>(value / MS_PER_S);                
> // ms to s
>            ^
> In file included from src/thrift/concurrency/Monitor.cpp:20:0:
> ./src/thrift/concurrency/Monitor.h:88:32: error: forward declaration of 
> 'struct apache::thrift::concurrency::timeval'
>    int waitForTime(const struct timeval* abstime) const;
> ...
> {noformat}
> This seems to be caused by {{Monitor.h}} using {{struct timeval}} but not 
> explicitly including {{sys/time.h}}. Changing {{Monitor.h}} so it 
> conditionally includes {{sys/time.h}} on systems that have it resolves the 
> issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to