diff mbox

[FFmpeg-devel] Win7 64b/mingw32 compilation fix

Message ID 757e02bc-d5f1-607e-49b3-099b2c91a7e4@chachatelier.fr
State New
Headers show

Commit Message

Pierre Chatelier March 2, 2018, 10:39 a.m. UTC
Hello,

I had an issue to compile ffmpeg under Win7 64 bits/mingw32
Adding an include was the solution.

Here is a patch

Pierre Chatelier
From 91f049a9424f80961a8bc3406dc60bccd1d516b9 Mon Sep 17 00:00:00 2001
From: Pierre Chatelier <pierre@chachatelier.fr>
Date: Fri, 2 Mar 2018 11:28:48 +0100
Subject: [PATCH 1/1] fix compilation under Win7 64bits with mingw32 by added
 <WinError.h> the EAI_MEMORY macro was mapped to ERROR_NOT_ENOUGH_MEMORY which
 was not defined

---
 libavformat/os_support.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Niedermayer March 3, 2018, 11:07 p.m. UTC | #1
On Fri, Mar 02, 2018 at 11:39:56AM +0100, Pierre Chatelier wrote:
> Hello,
> 
> I had an issue to compile ffmpeg under Win7 64 bits/mingw32
> Adding an include was the solution.
> 
> Here is a patch
> 
> Pierre Chatelier

>  os_support.c |    1 +
>  1 file changed, 1 insertion(+)
> 94a8add1b8bf480f59d0330f3c2205b8ffbb1cb2  0001-fix-compilation-under-Win7-64bits-with-mingw32-by-ad.patch
> From 91f049a9424f80961a8bc3406dc60bccd1d516b9 Mon Sep 17 00:00:00 2001
> From: Pierre Chatelier <pierre@chachatelier.fr>
> Date: Fri, 2 Mar 2018 11:28:48 +0100
> Subject: [PATCH 1/1] fix compilation under Win7 64bits with mingw32 by added
>  <WinError.h> the EAI_MEMORY macro was mapped to ERROR_NOT_ENOUGH_MEMORY which
>  was not defined
> 

breaks build on mingw64

src/libavformat/os_support.c:39:22: fatal error: WinError.h: No such file or directory
 #include <WinError.h>

 [...]
James Almer March 4, 2018, 1:16 a.m. UTC | #2
On 3/2/2018 7:39 AM, Pierre Chatelier wrote:
> Hello,
> 
> I had an issue to compile ffmpeg under Win7 64 bits/mingw32
> Adding an include was the solution.
> 
> Here is a patch
> 
> Pierre Chatelier
> 
> 0001-fix-compilation-under-Win7-64bits-with-mingw32-by-ad.patch
> 
> 
> From 91f049a9424f80961a8bc3406dc60bccd1d516b9 Mon Sep 17 00:00:00 2001
> From: Pierre Chatelier <pierre@chachatelier.fr>
> Date: Fri, 2 Mar 2018 11:28:48 +0100
> Subject: [PATCH 1/1] fix compilation under Win7 64bits with mingw32 by added
>  <WinError.h> the EAI_MEMORY macro was mapped to ERROR_NOT_ENOUGH_MEMORY which
>  was not defined
> 
> ---
>  libavformat/os_support.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/os_support.c b/libavformat/os_support.c
> index 86d0b8f306..f9bd5d9970 100644
> --- a/libavformat/os_support.c
> +++ b/libavformat/os_support.c
> @@ -36,6 +36,7 @@
>  #endif /* HAVE_SYS_TIME_H */
>  #if HAVE_WINSOCK2_H
>  #include <winsock2.h>
> +#include <WinError.h>

At least on mingw-w64, the header is called winerror.h, no capital letters.

Can you be more specific about your toolchain? Is mingw32, mingw-w64?
What version?
This is the first time i see anyone having this issue and we have
several people using different mingw and msvc tolchains.

>  #elif HAVE_SYS_SELECT_H
>  #include <sys/select.h>
>  #endif /* HAVE_WINSOCK2_H */
> -- 2.16.2
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Hendrik Leppkes March 4, 2018, 8:17 a.m. UTC | #3
On Sun, Mar 4, 2018 at 2:16 AM, James Almer <jamrial@gmail.com> wrote:
> On 3/2/2018 7:39 AM, Pierre Chatelier wrote:
>> Hello,
>>
>> I had an issue to compile ffmpeg under Win7 64 bits/mingw32
>> Adding an include was the solution.
>>
>> Here is a patch
>>
>> Pierre Chatelier
>>
>> 0001-fix-compilation-under-Win7-64bits-with-mingw32-by-ad.patch
>>
>>
>> From 91f049a9424f80961a8bc3406dc60bccd1d516b9 Mon Sep 17 00:00:00 2001
>> From: Pierre Chatelier <pierre@chachatelier.fr>
>> Date: Fri, 2 Mar 2018 11:28:48 +0100
>> Subject: [PATCH 1/1] fix compilation under Win7 64bits with mingw32 by added
>>  <WinError.h> the EAI_MEMORY macro was mapped to ERROR_NOT_ENOUGH_MEMORY which
>>  was not defined
>>
>> ---
>>  libavformat/os_support.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavformat/os_support.c b/libavformat/os_support.c
>> index 86d0b8f306..f9bd5d9970 100644
>> --- a/libavformat/os_support.c
>> +++ b/libavformat/os_support.c
>> @@ -36,6 +36,7 @@
>>  #endif /* HAVE_SYS_TIME_H */
>>  #if HAVE_WINSOCK2_H
>>  #include <winsock2.h>
>> +#include <WinError.h>
>
> At least on mingw-w64, the header is called winerror.h, no capital letters.
>
> Can you be more specific about your toolchain? Is mingw32, mingw-w64?
> What version?
> This is the first time i see anyone having this issue and we have
> several people using different mingw and msvc tolchains.
>

winerror.h should never be manually included, its included through
windows.h - which os_support.h includes, so it should be present.
If your version of mingw does not do that, its probably faulty.

- Hendrik
diff mbox

Patch

diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 86d0b8f306..f9bd5d9970 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -36,6 +36,7 @@ 
 #endif /* HAVE_SYS_TIME_H */
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
+#include <WinError.h>
 #elif HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif /* HAVE_WINSOCK2_H */