lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2013/11/14 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> > Can you try compiling your code defining _FILE_OFFSET_BITS to 32? (For
>> > instance you can add the option '-D_FILE_OFFSET_BITS=32' to cc.)
>> >
>>
>> Ok, with Lua 5.2.2 & 5.2.3-rc1.
>
> Thanks for the check.
>
> Since this seems to be a really special case (uClibc built without large
> file support), I think the sensible solution is for you to incorporate
> this definition in your make options. It does not seem reasonable to
> remove support for large files or to add a very specific #ifdef in the
> distribution because of this rather specific scenario.
>

I agree by default the support for large files must be enabled.
But, there's more than one way to do it.
See my patch where the variable LFSFLAGS in src/Makefile could be overloaded.
In my point of view, I remove one #ifdef.

François


> -- Roberto
>
diff --git a/src/Makefile b/src/Makefile
index 7b4b2b7..4a5e0b9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -7,7 +7,7 @@
 PLAT= none
 
 CC= gcc
-CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)
+CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(LFSFLAGS) $(MYCFLAGS)
 LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
 LIBS= -lm $(SYSLIBS) $(MYLIBS)
 
@@ -15,6 +15,8 @@
 RANLIB= ranlib
 RM= rm -f
 
+LFSFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
 SYSCFLAGS=
 SYSLDFLAGS=
 SYSLIBS=
diff --git a/src/liolib.c b/src/liolib.c
index 2a4ec4a..5e55a81 100644
--- a/src/liolib.c
+++ b/src/liolib.c
@@ -5,16 +5,6 @@
 */
 
 
-/*
-** This definition must come before the inclusion of 'stdio.h'; it
-** should not affect non-POSIX systems
-*/
-#if !defined(_FILE_OFFSET_BITS)
-#define	_LARGEFILE_SOURCE	1
-#define _FILE_OFFSET_BITS	64
-#endif
-
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>