Have g++ define _FILE_OFFSET_BITS=64 on Solaris

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Thu Jun 21 15:17:00 GMT 2018


Am 2018-06-21 um 16:17 schrieb Rainer Orth:
> I recently found two libstdc++ testcases failing on some Solaris hosts
> for 32-bit only:
> 
> FAIL: 27_io/filesystem/operations/space.cc execution test
> FAIL: experimental/filesystem/operations/space.cc execution test
> 
> Both file in the same way:
> 
> terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
>    what():  filesystem error: cannot get free space: Value too large for defined data type [.]
> 
> However, the test PASSes just fine on other systems.
> 
> It turns out that the tests FAIL with
> 
> statvfs(".", 0xFEFFDB64)                        Err#79 EOVERFLOW
> 
> On the failing system, the build filesystem is 3.4 TB, thus the
> EOVERFLOW.
> 
> It seems g++ on Solaris doesn't fully enable largefile support: it has
> -D_LARGEFILE_SOURCE=1 in gcc/config/sol2.h (TARGET_OS_CPP_BUILTINS), but
> lacks -D_FILE_OFFSET_BITS=64 which is required to get the
> largefile-aware functions (statvfs64 in this case).
> 
> The following patch adds that, fixing the two failures.
> 
> Bootstrapped without regressions on i386-pc-solaris2.1[01] and
> sparc-sun-solaris2.1[01].
> 
> Unless someone has an idea why this might cause problems, I'll install
> the patch on mainline and backport to the gcc-7 and gcc-8 branches.

No idea about possible problems, but isn't it usually recommended to use 
either _FILE_OFFSET_BITS=64 or _LARGEFILE{64}_SOURCE=1, not both at the 
same time?

Franz



More information about the Libstdc++ mailing list