First off, O_LARGEFILE is indeed a GNU extension. If you're not on a system with glibc (which basically means if you're not on Linux), simply get rid of O_LARGEFILE (or read your system's documentation on large file support).
If you are on Linux, the open(2) man page should tell you about O_LARGEFILE: “(LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened. The _LARGEFILE64_SOURCE macro must be defined in order to obtain this definition. Setting the _FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of obtaining method of accessing large files on 32-bit systems (see feature_test_macros(7)).”
The good news is that on Linux, at least, you can magically figure out what you need for large file support via getconf. That is, you don't need to (and probably shouldn't) set _FILE_OFFSET_BITS by hand. On 64-bit systems, I suspect off_t is already 64-bit (but don't quote me, I'm still in 32-bit land). getconf will know what, precisely, is needed on each system. So:
Code:
getconf LFS_CFLAGS
getconf LFS_LDFLAGS
getconf LFS_LIBS
will tell you all you need to know about LFS on your system. Once you use the proper defines to get 64-bit file I/O, you should drop the O_LARGEFILE. It's not needed, and, as the man page hints at, obsolescent.
UPDATE: I suppose O_LARGEFILE is a Linux extension, not GNU. The rest of the post stands, though.