Boost C++ Libraries: Ticket #13230: _FILE_OFFSET_BITS=64 breaks compilation with Android NDK r15 and API<24 https://svn.boost.org/trac10/ticket/13230 <p> Behavior of <code>_FILE_OFFSET_BITS</code> in Android NDK is described at android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md </p> <blockquote class="citation"> <p> Android support for <code>_FILE_OFFSET_BITS=64</code> (which turns off_t into <code>off64_t</code> and replaces each <code>off_t</code> function with its <code>off64_t</code> counterpart, such as <code>lseek</code> in the source becoming <code>lseek64</code> at runtime) was added late. Even when it became available for the platform, it wasn‘t available from the NDK until r15. Before NDK r15, <code>_FILE_OFFSET_BITS=64</code> silently did nothing: all code compiled with that was actually using a 32-bit <code>off_t</code>. With a new enough NDK, the situation becomes complicated. If you’re targeting an API before 21, almost all functions that take an <code>off_t</code> become unavailable. You‘ve asked for their 64-bit equivalents, and none of them (except <code>lseek</code>/<code>lseek64</code>) exist. As you increase your target API level, you’ll have more and more of the functions available. API 12 adds some of the <code>&lt;unistd.h&gt;</code> functions, API 21 adds mmap, and by API 24 you have everything including <code>&lt;stdio.h&gt;</code>. </p> </blockquote> <p> In <code>filesystem/src/operations.cpp</code> <code>_FILE_OFFSET_BITS</code> is unconditionally defined to <code>64</code> in hope that </p> <blockquote class="citation"> <p> at worst, these defines may have no effect </p> </blockquote> <p> It actually breaks compilation with Android NDK r15 if <code>__ANDROID_API__</code> is less than 24. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13230 Trac 1.4.3 joerg@… Thu, 07 Dec 2017 12:48:48 GMT <link>https://svn.boost.org/trac10/ticket/13230#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13230#comment:1</guid> <description> <p> It is also breaks compilation with Android NDK 16.0.4442984 and API level lower then 21. With API Level 21 it compiles without any error. See also my github report <a class="ext-link" href="https://github.com/boostorg/filesystem/issues/65"><span class="icon">​</span>https://github.com/boostorg/filesystem/issues/65</a> </p> </description> <category>Ticket</category> </item> <item> <author>rowanj@…</author> <pubDate>Wed, 20 Dec 2017 05:27:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13230#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13230#comment:2</guid> <description> <p> Also affected by this issue and can verify that the patch on <a class="missing wiki">GitHub</a> resolved it </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 08 Jan 2018 15:26:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13230#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13230#comment:3</guid> <description> <p> Where is the patch that fixes this? I'm running into this same issue using LLVM STL with Clang on NDK r16b while building boost 1.64. This is blocking my transition away from GNU STL. Note that GNU STL is deprecated and NDK team will be removing it soon. I feel a sense of urgency because of that. </p> </description> <category>Ticket</category> </item> <item> <author>joerg@…</author> <pubDate>Fri, 12 Jan 2018 12:21:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13230#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13230#comment:4</guid> <description> <p> This <a class="ext-link" href="https://github.com/boostorg/filesystem/files/1538797/android-boost-1_65_1-patches.patch.txt"><span class="icon">​</span>android-boost-1_65_1-patches.patch</a> in my github report <a class="ext-link" href="https://github.com/boostorg/filesystem/issues/65"><span class="icon">​</span>https://github.com/boostorg/filesystem/issues/65</a>. For the information, this patch only fix the build issue and not the problem! It builds and it also "runs" but it could be a problem on "large filesystem/files" ... I'm not sure. I'm not a filesystem expert. I still waiting for any boost filesystem contributor. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 01 Mar 2018 20:48:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13230#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13230#comment:5</guid> <description> <blockquote class="citation"> <p> it could be a problem on "large filesystem/files" ... I'm not sure </p> </blockquote> <p> to be clear: if your code worked on an older NDK, your patch is correct: it restores the old "use a 32-bit off_t" behavior. it's a neutral "(in)correctness preserving" change :-) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 19 Mar 2018 16:44:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13230#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13230#comment:6</guid> <description> <p> The issue is still not fixed. The issue is quite serious: Boost.Filesystem does not compile on Android. It is not the same issue as <a class="new ticket" href="https://svn.boost.org/trac10/ticket/13274" title="#13274: Bugs: boost.filesystem compile problem on Android (new)">#13274</a>. </p> <p> There is a pull request, addressing the issue: <a class="ext-link" href="https://github.com/boostorg/filesystem/pull/69"><span class="icon">​</span>https://github.com/boostorg/filesystem/pull/69</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>