<div dir="ltr">I use the simple way...<br><br>Gentoo's crossdev<br><br>crossdev -t i686-w64-mingw32<br>crossdev -t x86_64-w64-mingw32<br><br><div class="gmail_quote">On Wed, Oct 20, 2010 at 2:39 AM, Gianluca Varenni <span dir="ltr"><<a href="mailto:gianluca.varenni@cacetech.com">gianluca.varenni@cacetech.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">That should work.<br>
<br>
Can you tell me the exact steps and environment that you use to target 32bit<br>
with MINGW64?<br>
<div class="im"><br>
Have a nice day<br>
GV<br>
<br>
<br>
<br>
--------------------------------------------------<br>
</div><div class="im">From: "Alon Bar-Lev" <<a href="mailto:alon.barlev@gmail.com">alon.barlev@gmail.com</a>><br>
</div>Sent: Tuesday, October 19, 2010 10:33 AM<br>
<div><div></div><div class="h5">To: <<a href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</a>><br>
Subject: Re: [Winpcap-users] [PATCH] mingw build<br>
<br>
> Hi,<br>
><br>
> No I don't use -m32, you can build cross compile that targets 32bit<br>
> without multilib...<br>
> But it is not such important.<br>
><br>
> What I am suggesting is a simple Makefile rule, or just use the<br>
> autoconf provided with libpcap anyway... but if not, please consider<br>
> the following, then #include config.h, and use its constants to<br>
> conditionally do whatever.<br>
><br>
> target: config.h<br>
><br>
> config.h:<br>
> -rm config.h config.h.tmp<br>
> touch config.h.tmp<br>
> echo "#include <windows.h>" > conftest.c<br>
> echo "#include <ntddndis.h>" >> conftest.c<br>
> $(CC) -c conftest.c > /dev/null 2>&1 && echo "#define<br>
> HAVE_NTDDNDIS_H 1" >> config.h.tmp || true<br>
> echo "#include <windows.h>" > conftest.c<br>
> echo "#include <ddk/ntddndis.h>" >> conftest.c<br>
> $(CC) -c conftest.c > /dev/null 2>&1 && echo "#define<br>
> HAVE_DDK_NTDDNDIS_H 1" >> config.h.tmp || true<br>
> echo "int getaddrinfo();int main(void){getaddrinfo();}" ><br>
> conftest.c<br>
> $(CC) conftest.c -lws2_32 > /dev/null 2>&1 && echo "#define<br>
> HAVE_GETADDRINFO 1" >> config.h.tmp || true<br>
> mv config.h.tmp config.h<br>
><br>
><br>
><br>
> On Tue, Oct 19, 2010 at 6:51 PM, Gianluca Varenni<br>
> <<a href="mailto:gianluca.varenni@cacetech.com">gianluca.varenni@cacetech.com</a>> wrote:<br>
>><br>
>><br>
>> --------------------------------------------------<br>
>> From: "Alon Bar-Lev" <<a href="mailto:alon.barlev@gmail.com">alon.barlev@gmail.com</a>><br>
>> Sent: Tuesday, October 19, 2010 12:16 AM<br>
>> To: <<a href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</a>><br>
>> Subject: Re: [Winpcap-users] [PATCH] mingw build<br>
>><br>
>>> Hi,<br>
>>><br>
>>> This is incorrect:<br>
>>> ---<br>
>>> #ifdef __MINGW32__<br>
>>> +#ifdef __MINGW64__<br>
>>> +#include <ntddndis.h><br>
>>> +#else /*__MINGW64__*/<br>
>>> #include <ddk/ntddndis.h><br>
>>> +#endif /*__MINGW64__*/<br>
>>> #else<br>
>>> ---<br>
>>><br>
>>> As mingw-w64 can be used as both 32bit and 64bit (i686-w64-mingw32,<br>
>>> x86_64-w64-mingw32).<br>
>>> So you fix this for 64bit but if you use 32bit you will get the same<br>
>>> error.<br>
>><br>
>> I think I know what you mean now (after searching more on the internet).<br>
>> You<br>
>> are using MINGW64 *and* the option -m32 to generate 32bit binaries. I<br>
>> didn't<br>
>> know about the existence of -m32 ...<br>
>><br>
>> Regarding the addition of the ddk include in the makefile, the reason why<br>
>> I<br>
>> didn't do that is because I couldn't find a definition of the default<br>
>> include folder for that specific toolchain (and that works on mingw,<br>
>> mingw64, mingw64 with -m32, linux, windows, cygwin). Ideally the addition<br>
>> should be something like<br>
>><br>
>> CFLAGS = ........ -I ${default_include_dir}/ddk<br>
>><br>
>> but I haven't found what is the right env variable that I should put in<br>
>> place of "default_include_dir". I don't want to put an absolute path<br>
>> there.<br>
>><br>
>> I'm definitely open to suggestions...<br>
>><br>
>> Have a nice day<br>
>> GV<br>
>><br>
>><br>
>>><br>
>>> What I recommend is to add ddk include file LAST in the CPP search<br>
>>> list in make file.<br>
>>><br>
>>> Same goes to:<br>
>>> +/*<br>
>>> + * Mingw64 has its own implementation of getaddrinfo, mingw32 no<br>
>>> + */<br>
>>> +#ifndef __MINGW64__<br>
>>> +<br>
>>> +<br>
>>><br>
>>> Best to have it done in Makefile, by trying to compile something with<br>
>>> getaddrinfo and create mini config.h file.<br>
>>><br>
>>> If you want I can create such a patch. And if we do this, we can also<br>
>>> check if the ddk is needed or not using the same method.<br>
>>><br>
>>> Regards,<br>
>>> Alon Bar-Lev.<br>
>>><br>
>>> On Tue, Oct 19, 2010 at 12:19 AM, Gianluca Varenni<br>
>>> <<a href="mailto:gianluca.varenni@cacetech.com">gianluca.varenni@cacetech.com</a>> wrote:<br>
>>>><br>
>>>> I reworked the patch originally provided by Alon Bar-Lev (thanks!) a<br>
>>>> bit<br>
>>>> to<br>
>>>> have WinPcap 4.1.2 compile under MINGW32 and MINGW64, Windows and Linux<br>
>>>> cross compilation.<br>
>>>><br>
>>>> You can find it at<br>
>>>><br>
>>>> <a href="http://www.winpcap.org/install/bin/WinPcap_4_1_2_mingw_win.patch" target="_blank">http://www.winpcap.org/install/bin/WinPcap_4_1_2_mingw_win.patch</a><br>
>>>> <a href="http://www.winpcap.org/install/bin/WinPcap_4_1_2_mingw_linux.patch" target="_blank">http://www.winpcap.org/install/bin/WinPcap_4_1_2_mingw_linux.patch</a><br>
>>>><br>
>>>> MD5's are as follows:<br>
>>>><br>
>>>> 6cecf64649cfd4f32553025d2b6daa96 *WinPcap_4_1_2_mingw_linux.patch<br>
>>>> 8b341ba39bb0b621c81f5c8df7e7536a *WinPcap_4_1_2_mingw_win.patch<br>
>>>><br>
>>>> Due to a big mess with line endings in the source code of WinPcap 4.1.2<br>
>>>> (some files have the CR/LF line ending, some have the LF one), the<br>
>>>> patch<br>
>>>> that was working on Windows (with patch.exe coming from cygwin or<br>
>>>> MSYS)<br>
>>>> was<br>
>>>> not working on linux, and viceversa. So I created two patch files for<br>
>>>> WinPcap 4.1.2.<br>
>>>><br>
>>>> The resulting patched WinPcap 4.1.2 was tested on<br>
>>>> - Cygwin 1.7<br>
>>>> - MSYS+MINGW64 (I used the TDM-GCC one at <a href="http://tdm-gcc.tdragon.net/" target="_blank">http://tdm-gcc.tdragon.net/</a>)<br>
>>>> - MSYS+MINGW32 (I used the TDM-GCC one at <a href="http://tdm-gcc.tdragon.net/" target="_blank">http://tdm-gcc.tdragon.net/</a>)<br>
>>>> - MINGW32 on a debian "squeeze" machine<br>
>>>> - MINGW64 on a debian "squeeze" machine<br>
>>>><br>
>>>> Also, the same patches were committed on the WinPcap repository +<br>
>>>> libpcap<br>
>>>> repository (HEAD and libpcap_1.1 branch).<br>
>>>><br>
>>>> Have a nice day<br>
>>>> GV<br>
>>>><br>
>>>><br>
>>>><br>
>>>> --------------------------------------------------<br>
>>>> From: "Gianluca Varenni" <<a href="mailto:gianluca.varenni@cacetech.com">gianluca.varenni@cacetech.com</a>><br>
>>>> Sent: Tuesday, October 12, 2010 9:43 AM<br>
>>>> To: <<a href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</a>><br>
>>>> Subject: Re: [Winpcap-users] [PATCH] mingw build<br>
>>>><br>
>>>> ><br>
>>>> ><br>
>>>> > --------------------------------------------------<br>
>>>> > From: "Guy Harris" <<a href="mailto:guy@alum.mit.edu">guy@alum.mit.edu</a>><br>
>>>> > Sent: Wednesday, October 06, 2010 5:02 PM<br>
>>>> > To: <<a href="mailto:winpcap-users@winpcap.org">winpcap-users@winpcap.org</a>><br>
>>>> > Subject: Re: [Winpcap-users] [PATCH] mingw build<br>
>>>> ><br>
>>>> >><br>
>>>> >> On Sep 14, 2010, at 9:17 AM, Alon Bar-Lev wrote:<br>
>>>> >><br>
>>>> >>> 4. grammar.y - any idea why we need pcap_parse if yacc defines it<br>
>>>> >>> anyway instead of yyparse?<br>
>>>> >><br>
>>>> >> Because<br>
>>>> >><br>
>>>> >> 1) WinPcap is based on libpcap;<br>
>>>> >><br>
>>>> >> 2) libpcap was originally written back when many UN*Xes had only the<br>
>>>> >> old<br>
>>>> >> AT&T YACC, which only defined yyparse().<br>
>>>> >><br>
>>>> >> The current top-of-trunk version of grammar.y, at least, defines<br>
>>>> >> pcap_parse() only if YYBISON is not defined, which presumably means<br>
>>>> >> "not<br>
>>>> >> Bison".<br>
>>>> >><br>
>>>> >>> 5. yacc does not accept -y argument.<br>
>>>> >><br>
>>>> >> Earlier versions of GNUmakefile mirrored the UN*X Makefile.in, and<br>
>>>> >> had<br>
>>>> >> a<br>
>>>> >> YACC variable that ran Bison, rather than YACC, with the "-y" flag<br>
>>>> >> (which,<br>
>>>> >> for Bison, means "act like YACC and produce y.tab.c and y.tab.h<br>
>>>> >> files").<br>
>>>> >><br>
>>>> >> The 4.1.2 version runs whatever make sets YACC to refer to, with the<br>
>>>> >> YFLAGS flag. Is there some reason why that was done?<br>
>>>> ><br>
>>>> > No idea. The original GNUMakefile was contributed by someone and<br>
>>>> > included<br>
>>>> > into the WinPcap sources.<br>
>>>> > I modified GNUMakefile to<br>
>>>> > 1. define "BISON = bison" and "FLEX = flex"<br>
>>>> > 2. use ${BISON} to compile grammar.y<br>
>>>> ><br>
>>>> ><br>
>>>> >> Was this to support parser-generators *other* than Bison? Unless<br>
>>>> >> there's<br>
>>>> >> a compelling reason not to run Bison, it should probably go back to<br>
>>>> >> the<br>
>>>> >> way it was, using Bison - that'll fix that problem *and* the<br>
>>>> >> previous<br>
>>>> >> problem, with no changes required to grammar.y.<br>
>>>> >><br>
>>>> >> If there *is* a compelling reason not to run Bison, then<br>
>>>> >><br>
>>>> >> 1) it should not include "-y"<br>
>>>> >><br>
>>>> >> and<br>
>>>> >><br>
>>>> >> 2) either it should not do "-p pcap_", if whatever version of YACC<br>
>>>> >> is<br>
>>>> >> being used doesn't support "-p", or:<br>
>>>> >><br>
>>>> >> 2a) grammar.y should check for YYBISON *and* some other #define<br>
>>>> >> named<br>
>>>> >> appropriately for whatever parser-generator is being used<br>
>>>> >><br>
>>>> >> and<br>
>>>> >><br>
>>>> >> 2b) it should do "-D{that #define name}".<br>
>>>> >><br>
>>>> >>> 7. Minor modification of (char*)A += code.<br>
>>>> >><br>
>>>> >> (I.e., "casting lvalues considered harmful - and possibly rejected<br>
>>>> >> by<br>
>>>> >> some<br>
>>>> >> compilers.")<br>
>>>> ><br>
>>>> > I will commit it on the libpcap git repository as soon as possible.<br>
>>>> ><br>
>>>> > Have a nice day<br>
>>>> > GV<br>
>>>> ><br>
>>>> >> _______________________________________________<br>
>>>> >> Winpcap-users mailing list<br>
>>>> >> <a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
>>>> >> <a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
>>>> ><br>
>>>> > _______________________________________________<br>
>>>> > Winpcap-users mailing list<br>
>>>> > <a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
>>>> > <a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Winpcap-users mailing list<br>
>>>> <a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
>>>> <a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
>>> _______________________________________________<br>
>>> Winpcap-users mailing list<br>
>>> <a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
>>> <a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
>>><br>
>> _______________________________________________<br>
>> Winpcap-users mailing list<br>
>> <a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
>> <a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
>><br>
> _______________________________________________<br>
> Winpcap-users mailing list<br>
> <a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
> <a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
><br>
_______________________________________________<br>
Winpcap-users mailing list<br>
<a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
<a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
</div></div></blockquote></div><br></div>