--- a/src/libOpenImageIO/exif.cpp
+++ b/src/libOpenImageIO/exif.cpp
@@ -36,6 +36,7 @@
 #include <cctype>
 #include <cstdio>
 #include <iostream>
+#include <malloc.h>
 #include <set>
 #include <sstream>
 #include <vector>
--- a/src/libOpenImageIO/imageinput.cpp
+++ b/src/libOpenImageIO/imageinput.cpp
@@ -32,6 +32,7 @@
 #include <cmath>
 #include <cstdio>
 #include <cstdlib>
+#include <malloc.h>
 #include <memory>
 #include <vector>
 
--- a/src/libtexture/imagecache.cpp
+++ b/src/libtexture/imagecache.cpp
@@ -32,6 +32,7 @@
 
 
 #include <cstring>
+#include <malloc.h>
 #include <memory>
 #include <sstream>
 #include <string>
--- a/src/libtexture/texturesys.cpp
+++ b/src/libtexture/texturesys.cpp
@@ -30,6 +30,7 @@
 #include <cmath>
 #include <cstring>
 #include <list>
+#include <malloc.h>
 #include <sstream>
 #include <string>
 
--- a/src/libutil/argparse.cpp
+++ b/src/libutil/argparse.cpp
@@ -39,6 +39,7 @@
 #include <cstring>
 #include <iostream>
 #include <iterator>
+#include <malloc.h>
 #include <sstream>
 #include <string>
 
--- a/src/libutil/sysutil.cpp
+++ b/src/libutil/sysutil.cpp
@@ -137,7 +137,7 @@ Sysutil::get_local_time (const time_t *time, struct tm *converted_time)
 #ifdef _MSC_VER
     localtime_s(converted_time, time);
 #else
-    localtime_r(time, converted_time);
+    *converted_time = *localtime(time);
 #endif
 }
 
--- a/src/rla.imageio/rlaoutput.cpp
+++ b/src/rla.imageio/rlaoutput.cpp
@@ -32,6 +32,7 @@
 #include <cstdlib>
 #include <cmath>
 #include <ctime>
+#include <malloc.h>
 
 #include "dassert.h"
 #include "typedesc.h"
--- a/src/cmake/modules/FindFFmpeg.cmake.orig	2016-07-11 14:14:12.042802600 +0300
+++ b/src/cmake/modules/FindFFmpeg.cmake	2016-07-11 14:14:56.699302600 +0300
@@ -64,6 +64,7 @@
     )
 
   if (FFmpeg_FOUND)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
     set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
     set(FFMPEG_INCLUDES ${FFMPEG_AVCODEC_INCLUDE_DIR})
     set(FFMPEG_LIBRARIES
