[ts-gen] compile problems on cygwin

Gabriel Ricardo gricardo99 at yahoo.com
Mon May 26 00:17:55 EDT 2008


Hi Bill,
Wow!  What great support!  Thanks to your efforts I was able to compile trader shim on cygwin.  I followed your instructions but i also had to do some looking online on how to get MySQL client and support files installed on cygwin.  I found this link very helpful:
http://cygwin.com/ml/cygwin/2007-03/msg00835.html
I was able to run the MySQL client test code provided while running a MySQL server native on windows.  That convinced me that MySQL was ready to go providing I could get the rest of it working, which is still a work in progress.  
I'm still stuck on the getaddrinfo workaround.  My windows version (XP) has getaddrinfo function in ws2tcpip.h and ws2_32.dll, but I had compile errors trying to include that file, and link to the dll.  The errors I get are of the nature, 
error: redefinition of `struct timeval`
error: redefinition of `struct hostent`
etc...
These errors come from some of the windows include files that get sucked in when including ws2tcpip.h.  Seems the whole winsock infrastructure conflicts with some of the unix includes.  
I'm still debugging and working on this, but I just wanted to give a preliminary report. Hopefully I'll have some better news soon.

Thanks for your help,
-Gabriel


--- On Fri, 5/23/08, Bill Pippin <pippin at owlriver.net> wrote:

> From: Bill Pippin <pippin at owlriver.net>
> Subject: Re: [ts-gen] compile problems on cygwin
> To: gricardo99 at yahoo.com, "trading-shim general mailing list" <ts-general at trading-shim.org>
> Date: Friday, May 23, 2008, 1:53 PM
> Gabriel,
> 
> I've just pushed a release that should compile under
> cygwin.  Our sole
> windows box is too outdated for the code to run there, but
> we have
> compiled and linked successfully, about which more
> following
> the quoted material below.  That text, from the top of the
> NEWS file,
> consists of, first, a description of what we've done,
> so you understand
> the context; and second, directions for compilation, in the
> likely case
> that the new release doesn't compile on cygwin out of
> the box.
> 
> > * For cygwin: add -lz to Makefile library link list,
> for the benefit
> >   of mysql; add Makefile mk.cygwin.patch to root
> directory, for
> >   typical /usr/local/mysql install on cygwin -- change
> as needed for
> >   your local setup; add lib/math.c, for llrint, and
> corresponding
> >   patch math.cygwin.patch, to replace library call to
> llrint with
> >   inline assembler; add lib/math.h, as part of a
> revision of header
> >   file structure to handle the use of macros in newlib
> to implement
> >   certain standard math library procedure; and remove
> cruft from
> >   src/functional.h.
> 
> >   Cygwin doesn't supply llrint, and the shim needs
> it, so apply the
> >   patch math.cygwin.patch to lib/math.c, or just edit
> the #if to
> >   change the 0 to a 1.
> 
> >   Cygwin doesn't supply getaddrinfo, and the shim
> needs it, so unless
> >   your Windows provides getaddrinfo, the shim still
> may not compile
> >   completely for a cygwin box.  In that case you can: 
> patch lib/inet.c
> >   with inet.patch, and check that the shim now
> compiles, starts up,
> >   and runs up until the failed attemp to connect to
> the IB~tws; and
> >   then back the patch out, and come up with
> getaddrinfo somehow.
> >   Possibilities:
> 
> >     + newer Windows have getaddrinfo, so it may just
> be a matter of
> >       the Makefile not knowing where it is.  If you
> can figure out
> >       what header file is needed, and add it to
> lib/inet-h.h, that
> >       may do the trick.
> 
> >     + there are service packs for some older Windows
> that add in
> >       getaddrinfo, and if you can come up with such a
> service pack,
> >       that may do the job.
> 
> >     + I realize other projects, e.g., Postgresql, have
> a replacement
> >       getaddrinfo.  Unfortunately those:
> >         - include thousands of lines of
> project-specific header file
> >           cruft, and
> >         - boil down to:
> >             . forwarding to the system getaddrinfo, if
> possible, or
> >             . falling back on the older,
> obsolescent-under-POSIX.1
> >               gethostbyname(), which brings me to a
> shorter, more
> >               direct solution:
> 
> >     + cygwin with newlib does provide gethostbyname,
> and you
> >       can modify the code in lib/inet.c and
> lib/socket.h to perform
> >       the connection using that function.
> 
> >     + wait; from the announcement of the cygwin 1.7
> development
> >       cycle,
> http://cygwin.com/ml/cygwin-apps/2008-04/msg00185.html :
> 
> >         - IPv6 support.  New API getaddrinfo, ...
> >                                  ^^^^^^^^^^^
> >         - New APIs: asnprintf, dprintf, _Exit,
> vasnprintf, vdprintf,
> >           confstr, posix_madvise, posix_memalign,
> exp10, exp10f,
> >           pow10, pow10f, lrint, lrintf, rint, rintf,
> llrint, ...
> >                                                     
> ^^^^^^
> 
> > In any case, please let those of us on the list know
> about your
> > experience.  Cygwin has proven to be our most
> difficult porting
> > problem yet, and with the getaddrinfo problem,
> it's not a fully
> > solved problem, so your feedback is especially
> important.
> 
> > Without your posting to close the loop, the time
> we've put into
> > porting the shim to your architecture is wasted.
> 
> So, you'll need to download the 080523 release; patch
> the Makefile,
> possibly using mk.cygwin.patch, and in any case providing
> the location
> of the mysql headers and libraries; patch lib/math.c,
> possibly using
> the patch math.cygwin.patch, but in any case flipping the
> #if 0 to
> #if 1 in mmm_llrint(), to provide a llrint substitute for
> cygwin's
> benefit; attempt a compile, which may fail if your system
> lacks
> getaddrinfo(); and, in that case, consider your options
> above.
> 
> In any case, please let us (the mailing list) know how far
> you get,
> and in the case that you have a working getaddrinfo, if the
> shim
> works correctly for you.
> 
> Thanks,
> 
> Bill


      


More information about the ts-general mailing list