On Thu, Jun 30, 2016 at 2:14 PM, Guy Harris <g...@alum.mit.edu> wrote:

> On Jun 30, 2016, at 12:59 PM, Yang Luo <hslu...@gmail.com> wrote:
>
> > But I encountered an issue here, the built out scanner.h and scanner.c
> will report these errors:
> >
> > 1>  gencode.c
> > 1>..\scanner.h(239): fatal error C1083: Cannot open include file:
> 'unistd.h': No such file or directory
> > 1>  grammar.c
> > 1>..\scanner.h(239): fatal error C1083: Cannot open include file:
> 'unistd.h': No such file or directory
> > 1>..\scanner.c(2787): fatal error C1083: Cannot open include file:
> 'unistd.h': No such file or directory
> >
> > It seems that these generated source files want to include a UN*X only
> file "unistd.h", which is not available on Windows, like you said in the
> next reply. I think I need to switch some options to let Flex not use
> "unistd.h", how to do it?
> >
> > OK. I found the solution. I changed the bat to:
> >
> > win_flex -Ppcap_ -7 --nounistd --outfile=..\scanner.c
> --header-file=..\scanner.h ..\scanner.l
> > win_bison -ppcap_ --yacc --output=..\grammar.c --defines ..\grammar.y
> >
> > And Flex won't let the generated source filess require "unistd.h" any
> more.
> >
> >
> > When this bat is done, I think I will make MSVC run this bat every time
> before a build process starts, is this solution OK for you?
>
> That'd one way to do it.  Another way is to have the project define
> YY_NO_UNISTD_H - that's what CMake does.
>

Agreed, I will use the project definition way then, which has been done in
https://github.com/the-tcpdump-group/libpcap/pull/508


>
> >>> And installing flex and bison for Windows are not also very friendly.
> >>
> >>         https://twitter.com/geraldcombs/status/735870968451629056
> >
> > In fact I didn't catch the meaning very well.. What's a "IKEA motorcycle
> engine"? I think "IKEA" is a furniture vendor? What does it has to do with
> the motorcycle engine?
>
> A lot of the furniture that IKEA sells is un-assembled, so you take it
> home in a flat package and assemble it at home.
>
> For furniture, that works.
>
> But if IKEA sold motorcycle engines that way, it wouldn't work as well:
>
>
> http://www-psych.stanford.edu/~bt/diagrams/papers/animationearli04_files/image012.png
>
> You'd have a *lot* more work to do to assemble it, and you'd have to know
> a *lot* more in order to do it right.
>

Aha, good to learn it:) It's definitely a bad idea to ask users to assembly
a motorcycle engine.


>
> > Does it mean that building open source on Windows is very painful and
> inconvenient?
>
> Pretty much, yes.
>
> When you want to build open-source software on a UN*X, as long as you have
> all of the necessary tools and libraries installed, it's usually just
> ./configure; make; make install - or maybe
>
>         mkdir build
>         cd build
>         cmake ..
>         make
>         make install
>
> if it's using CMake, and the necessary tools and libraries are usually
> either
>
>         1) installed by default;
>
>         2) installable as a package provided by the OS developer;
>
>         3) installable from a third-party binary package;
>
>         4) installable from source.
>
> A lot of this is because most UN*Xes are very similar, with the
> differences mostly being relatively minor annoyances.
>
> On Windows, you may need built-for-Windows - or even ported-to-Windows -
> versions of the same tools and libraries, and the autotools (configure
> script) often don't work.  If the project uses CMake, it might work,
> although even there you may have to do a bunch of "if(WIN32)" in the CMake
> files.


Using CMake for libpcap's Windows version building can be a future work.
Currently, let's make the hand-crafted MSVC project building process work
first.


Cheers,
Yang
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Reply via email to