[Winpcap-users] [PATCH] mingw build

Gianluca Varenni gianluca.varenni at cacetech.com
Mon Oct 18 15:19:03 PDT 2010


I reworked the patch originally provided by Alon Bar-Lev (thanks!) a bit to 
have WinPcap 4.1.2 compile under MINGW32 and MINGW64, Windows and Linux 
cross compilation.

You can find it at

http://www.winpcap.org/install/bin/WinPcap_4_1_2_mingw_win.patch
http://www.winpcap.org/install/bin/WinPcap_4_1_2_mingw_linux.patch

MD5's are as follows:

6cecf64649cfd4f32553025d2b6daa96 *WinPcap_4_1_2_mingw_linux.patch
8b341ba39bb0b621c81f5c8df7e7536a *WinPcap_4_1_2_mingw_win.patch

Due to a big mess with line endings in the source code of WinPcap 4.1.2 
(some files have the CR/LF line ending, some have the LF one), the patch 
that was working on Windows  (with patch.exe coming from cygwin or MSYS) was 
not working on linux, and viceversa. So I created two patch files for 
WinPcap 4.1.2.

The resulting patched WinPcap 4.1.2 was tested on
- Cygwin 1.7
- MSYS+MINGW64 (I used the TDM-GCC one at http://tdm-gcc.tdragon.net/)
- MSYS+MINGW32 (I used the TDM-GCC one at http://tdm-gcc.tdragon.net/)
- MINGW32 on a debian "squeeze" machine
- MINGW64 on a debian "squeeze" machine

Also, the same patches were committed on the WinPcap repository + libpcap 
repository (HEAD and libpcap_1.1 branch).

Have a nice day
GV



--------------------------------------------------
From: "Gianluca Varenni" <gianluca.varenni at cacetech.com>
Sent: Tuesday, October 12, 2010 9:43 AM
To: <winpcap-users at winpcap.org>
Subject: Re: [Winpcap-users] [PATCH] mingw build

>
>
> --------------------------------------------------
> From: "Guy Harris" <guy at alum.mit.edu>
> Sent: Wednesday, October 06, 2010 5:02 PM
> To: <winpcap-users at winpcap.org>
> Subject: Re: [Winpcap-users] [PATCH] mingw build
>
>>
>> On Sep 14, 2010, at 9:17 AM, Alon Bar-Lev wrote:
>>
>>> 4. grammar.y - any idea why we need pcap_parse if yacc defines it
>>> anyway instead of yyparse?
>>
>> Because
>>
>> 1) WinPcap is based on libpcap;
>>
>> 2) libpcap was originally written back when many UN*Xes had only the old
>> AT&T YACC, which only defined yyparse().
>>
>> The current top-of-trunk version of grammar.y, at least, defines
>> pcap_parse() only if YYBISON is not defined, which presumably means "not
>> Bison".
>>
>>> 5. yacc does not accept -y argument.
>>
>> Earlier versions of GNUmakefile mirrored the UN*X Makefile.in, and had a
>> YACC variable that ran Bison, rather than YACC, with the "-y" flag 
>> (which,
>> for Bison, means "act like YACC and produce y.tab.c and y.tab.h files").
>>
>> The 4.1.2 version runs whatever make sets YACC to refer to, with the
>> YFLAGS flag.  Is there some reason why that was done?
>
> No idea. The original GNUMakefile was contributed by someone and included
> into the WinPcap sources.
> I modified GNUMakefile to
> 1. define "BISON = bison" and "FLEX = flex"
> 2. use ${BISON} to compile grammar.y
>
>
>> Was this to support parser-generators *other* than Bison?  Unless there's
>> a compelling reason not to run Bison, it should probably go back to the
>> way it was, using Bison - that'll fix that problem *and* the previous
>> problem, with no changes required to grammar.y.
>>
>> If there *is* a compelling reason not to run Bison, then
>>
>> 1) it should not include "-y"
>>
>> and
>>
>> 2) either it should not do "-p pcap_", if whatever version of YACC is
>> being used doesn't support "-p", or:
>>
>> 2a) grammar.y should check for YYBISON *and* some other #define named
>> appropriately for whatever parser-generator is being used
>>
>> and
>>
>> 2b) it should do "-D{that #define name}".
>>
>>> 7. Minor modification of (char*)A += code.
>>
>> (I.e., "casting lvalues considered harmful - and possibly rejected by 
>> some
>> compilers.")
>
> I will commit it on the libpcap git repository as soon as possible.
>
> Have a nice day
> GV
>
>> _______________________________________________
>> Winpcap-users mailing list
>> Winpcap-users at winpcap.org
>> https://www.winpcap.org/mailman/listinfo/winpcap-users
>
> _______________________________________________
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
> https://www.winpcap.org/mailman/listinfo/winpcap-users 



More information about the Winpcap-users mailing list