diff --git a/Makefile b/Makefile
index 40d7826e87089842617060d1db5c47eea311a217..3cb514a259c7edcd36137fb1f467b8a1ec5ed7b7 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ include config.mak
 
 VPATH=$(SRC_PATH)
 
-CFLAGS= $(OPTFLAGS) -Wall -g -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav
+CFLAGS= $(OPTFLAGS) -Wall -g -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 LDFLAGS= -g
 ifeq ($(TARGET_GPROF),yes)
 CFLAGS+=-p
diff --git a/libav/Makefile b/libav/Makefile
index a0a5008912cf4184fa2ee4e2dbedfb7af316c392..48dacabe5dc229b6c9d03023f76f1c443434767f 100644
--- a/libav/Makefile
+++ b/libav/Makefile
@@ -6,7 +6,7 @@ include ../config.mak
 
 VPATH=$(SRC_PATH)/libav
 
-CFLAGS= $(OPTFLAGS) -Wall -g -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H
+CFLAGS= $(OPTFLAGS) -Wall -g -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 
 OBJS= utils.o 
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3efa5919199e67ec510917a15ea5cc58a2e012af..6d54abb95335766af51f9364dbbb747da8b24d9f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -7,7 +7,7 @@ include ../config.mak
 VPATH=$(SRC_PATH)/libavcodec
 
 # NOTE: -I.. is needed to include config.h
-CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I..
+CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 LDFLAGS= -g
 
 OBJS= common.o utils.o mem.o allcodecs.o \