title: C++ compilation stuck with boost interprocess lib 'error: `::ftruncate' has not been declared'
body: <p>This is what I get when I run <code>make</code> :</p>
  
  <pre><code>In file included from /usr/include/boost/interprocess/sync/file_lock.hpp:25:0,
                   from init.cpp:61:
  /usr/include/boost/interprocess/detail/os_file_functions.hpp: In function `bool boost::interprocess::ipcdetail::truncate_file
  (boost::interprocess::file_handle_t, std::size_t)':
  /usr/include/boost/interprocess/detail/os_file_functions.hpp:489:16: error: `::ftruncate' has not been declared
      return 0 == ::ftruncate(hnd, off_t(size));
                  ^~
  init.cpp: In function `void registerSignalHandler(int, void (*)(int))':
  init.cpp:302:22: error: aggregate `registerSignalHandler(int, void (*)(int))::sigaction sa' has incomplete type and cannot be
   defined
       struct sigaction sa;
                        ^~
  init.cpp:304:28: error: `sigemptyset' was not declared in this scope
       sigemptyset(&amp;sa.sa_mask);
                              ^
  init.cpp:306:35: error: invalid use of incomplete type `struct registerSignalHandler(int, void (*)(int))::sigaction'
       sigaction(signal, &amp;sa, nullptr);
                                     ^
  init.cpp:302:12: note: forward declaration of `struct registerSignalHandler(int, void (*)(int))::sigaction'
       struct sigaction sa;
              ^~~~~~~~~
  </code></pre>
  
  <p>I am on cygwin</p>
  
  <p><code>$ uname -a
  CYGWIN_NT-6.1-WOW abcd 2.9.0(0.318/5/3) 2017-09-12 10:41 i686 Cygwin</code></p>
  
  <p>I am not sure if all the build errors are related to the missing ::ftruncate, but I would like to start there.</p>
  
  <p>Any thoughts/suggestions are welcome.</p>
  
  <p>TIA</p>
  
  <p><strong>Update #1</strong>:
  /usr/include/boost/interprocess/detail/os_file_functions.hpp does contain the required headers:</p>
  
  <pre><code>#if defined (BOOST_INTERPROCESS_WINDOWS)
  #  include &lt;boost/interprocess/detail/win32_api.hpp&gt;
  #else
  #  ifdef BOOST_HAS_UNISTD_H
  #     include &lt;fcntl.h&gt;
  #     include &lt;unistd.h&gt;
  #     include &lt;sys/types.h&gt;
  #     include &lt;sys/stat.h&gt;
  #     include &lt;errno.h&gt;
  #     include &lt;cstdio&gt;
  #     include &lt;dirent.h&gt;
  #     if 0
  #        include &lt;sys/file.h&gt;
  #     endif
  #  else
  #    error Unknown platform
  #  endif
  #endif
  </code></pre>
  
  <p><strong>Update #2:</strong> (using new CPPFLAG -> <code>-D_XOPEN_SOURCE=500</code>)</p>
  
  <pre><code>In file included from /usr/include/boost/assert.hpp:58:0,
                   from /usr/include/boost/range/size.hpp:23,
                   from /usr/include/boost/range/functions.hpp:20,
                   from /usr/include/boost/range/iterator_range_core.hpp:38,
                   from /usr/include/boost/range/iterator_range.hpp:13,
                   from /usr/include/boost/range/as_literal.hpp:22,
                   from /usr/include/boost/algorithm/string/case_conv.hpp:19,
                   from netbase.cpp:25:
  netbase.cpp: In function `bool LookupIntern(const char*, std::vector&lt;CNetAddr&gt;&amp;, unsigned int, bool)':
  netbase.cpp:95:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
               assert(aiTrav-&gt;ai_addrlen &gt;= sizeof(sockaddr_in));
                      ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
  netbase.cpp:101:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
               assert(aiTrav-&gt;ai_addrlen &gt;= sizeof(sockaddr_in6));
                      ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
  netbase.cpp: In function `std::string NetworkErrorString(int)':
  netbase.cpp:720:41: error: `strerror_r' was not declared in this scope
       if (strerror_r(err, buf, sizeof(buf)))
                                           ^
  </code></pre>