[Bug libstdc++/22388] New: When cross-compiling libstdc++ for mingw, enable large file support (LFS)
I have tracked down the cause of Debian bug <http://bugs.debian.org/306210>: When you compile C++ programs using Debian's mingw32 cross-compiler package (currently based on mingw32-3.4.2.20040916.1), then the compiled C++ programs do not have large file support enabled. The simple fix is to enable LFS in libstdc++-v3/crossconfig.m4. This bug probably also applies to GCC versions 3.4.3 .. 4.0 Patch: --- gcc-3.4.2-20040916-1/libstdc++-v3/crossconfig.m4.orig 2004-08-15 10:41:14.0 +0200 +++ gcc-3.4.2-20040916-1/libstdc++-v3/crossconfig.m4 2005-07-09 19:53:15.0 +0200 @@ -234,6 +234,7 @@ GLIBCXX_CHECK_LINKER_FEATURES GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT GLIBCXX_CHECK_WCHAR_T_SUPPORT +AC_DEFINE(_GLIBCXX_USE_LFS) ;; *-netbsd*) AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ -- Summary: When cross-compiling libstdc++ for mingw, enable large file support (LFS) Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ra at atterer dot net CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i586-mingw32msvc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22388
[Bug libstdc++/22388] When cross-compiling libstdc++ for mingw, enable large file support (LFS)
--- Additional Comments From ra at atterer dot net 2005-07-10 08:39 --- (In reply to comment #1) > mingw runtime does not have struct stat64 or fstat64(), so this define is not > correct. Hmm - but I've successfully cross-compiled libstdc++ on Linux with this #define, and I'm 100% sure it made a difference - my cross-compiled program can now access large files under Windows, previously it couldn't. Look e.g. at the code in libstdc++-v3/config/io/basic_file_stdio.cc: #if defined (_GLIBCXX_USE_LFS) && defined (__MINGW32__) struct _stati64 __buffer; int __ret = _fstati64 (this->fd(), &__buffer); ... It's all there, and _GLIBCXX_USE_LFS is needed to enable it. BTW, your native mingw builds do have large file support, LFS only breaks if libstdc++ is cross-compiled. The rest of libstdc++ does not use fstat64(), only fstat() - I guess it relies on someone re#defing it to fstat64 (or, in fact, _fstati64). Richard (OP) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22388