[ts-gen] compile problems on cygwin

Bill Pippin pippin at owlriver.net
Fri May 23 13:53:56 EDT 2008


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.



More information about the ts-general mailing list