cygwin 编译mysql问题


问题1:sys/ttydefaults.h: No such file or directory



R: Error when compiling mySQL client libraries

--- Mer 27/1/10, Jurgen Defurne ha scritto:

> While trying to compile mySQL 5.1.34
> client libraries, I get the
> following errors :
>
> In file included from readline.c:54:
> readline/readline.h:70:29: error: sys/ttydefaults.h: No
> such file or directory
> make[2]: *** [readline.o] Error 1
> make[2]: Leaving directory
> `/home/beq00908/mv_builds/mysql-5.1.34/cmd-line-utils/libedit'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory
> `/home/beq00908/mv_builds/mysql-5.1.34/cmd-line-utils'
> make: *** [all-recursive] Error 1
>
> In which package is sys/ttydefaults.h supposed to be ?
>
> Regards,
>
> Jurgen
>

Hi Jurgen,
there is a fault in the editline/libedit package..
When I built it for another package from
http://thrysoee.dk/editline/
I modified as :

--- origsrc/libedit-20090923-3.0/src/editline/readline.h        2009-09-23 23:04:26.000000000 +0200
+++ src/libedit-20090923-3.0/src/editline/readline.h    2009-09-27 21:53:26.000000000 +0200
@@ -75,7 +75,7 @@ typedef KEYMAP_ENTRY *Keymap;

 #ifndef CTRL
 #include <sys/ioctl.h>
-#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__CYGWIN__)
 #include <sys/ttydefaults.h>
 #endif
 #ifndef CTRL

see attached the full patch.

Is someone interested to have libedit package
in cygwin ?


Regards
Marco

--- origsrc/libedit-20090923-3.0/src/editline/readline.h    2009-09-23 23:04:26.000000000 +0200
+++ src/libedit-20090923-3.0/src/editline/readline.h    2009-09-27 21:53:26.000000000 +0200
@@ -75,7 +75,7 @@ typedef KEYMAP_ENTRY *Keymap;
 
 #ifndef CTRL
 #include <sys/ioctl.h>
-#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__CYGWIN__)
 #include <sys/ttydefaults.h>
 #endif
 #ifndef CTRL
--- origsrc/libedit-20090923-3.0/src/vi.c    2009-09-23 23:04:26.000000000 +0200
+++ src/libedit-20090923-3.0/src/vi.c    2009-09-27 21:56:26.000000000 +0200
@@ -916,6 +916,11 @@ vi_comment_out(EditLine *el, int c)
  * NB: posix implies that we should enter insert mode, however
  * this is against historical precedent...
  */
+
+#ifdef __CYGWIN__
+#undef __weak_reference
+#endif
+
 #ifdef __weak_reference
 extern char *get_alias_text(const char *) __weak_reference(get_alias_text);
 #endif

--


Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

    Follow-Ups:
        Re: R: Error when compiling mySQL client libraries
            From: Yaakov (Cygwin/X)



问题2:dtoa 冲突问题




[5 Oct 2011 3:20] Jason Pyeron

Description:
[  5%] Building C object strings/CMakeFiles/strings.dir/dtoa.c.o
/projects/mysql/mysql-5.5.16/strings/dtoa.c:55:14: error: conflicting types for 'dtoa'
/usr/include/stdlib.h:162:8: note: previous declaration of 'dtoa' was here
make[2]: *** [strings/CMakeFiles/strings.dir/dtoa.c.o] Error 1
make[1]: *** [strings/CMakeFiles/strings.dir/all] Error 2
make: *** [all] Error 2

cygwin2.patch file:

--- mysql-5.5.16.orig/strings/dtoa.c    2011-10-04 22:51:51.296875000 -0400
+++ mysql-5.5.16/strings/dtoa.c    2011-10-04 22:56:50.109375000 -0400
@@ -48,11 +48,11 @@
 */
 #define DTOA_BUFF_SIZE (420 * sizeof(void *))
 
-/* Magic value returned by dtoa() to indicate overflow */
+/* Magic value returned by _dtoa() to indicate overflow */
 #define DTOA_OVERFLOW 9999
 
 static double my_strtod_int(const char *, char **, int *, char *, size_t);
-static char *dtoa(double, int, int, int *, int *, char **, char *, size_t);
+static char *_dtoa(double, int, int, int *, int *, char **, char *, size_t);
 static void dtoa_free(char *, char *, size_t);
 
 /**
@@ -61,7 +61,7 @@
    representation using the 'f' format.
 
    @details
-   This function is a wrapper around dtoa() to do the same as
+   This function is a wrapper around _dtoa() to do the same as
    sprintf(to, "%-.*f", precision, x), though the conversion is usually more
    precise. The only difference is in handling [-,+]infinity and nan values,
    in which case we print '0\0' to the output string and indicate an overflow.
@@ -93,7 +93,7 @@
   char buf[DTOA_BUFF_SIZE];
   DBUG_ASSERT(precision >= 0 && precision < NOT_FIXED_DEC && to != NULL);
   
-  res= dtoa(x, 5, precision, &decpt, &sign, &end, buf, sizeof(buf));
+  res= _dtoa(x, 5, precision, &decpt, &sign, &end, buf, sizeof(buf));
 
   if (decpt == DTOA_OVERFLOW)
   {
@@ -189,7 +189,7 @@
 
    @todo
    Check if it is possible and  makes sense to do our own rounding on top of
-   dtoa() instead of calling dtoa() twice in (rare) cases when the resulting
+   _dtoa() instead of calling _dtoa() twice in (rare) cases when the resulting
    string representation does not fit in the specified field width and we want
    to re-round the input number with fewer significant digits. Examples:
 
@@ -200,10 +200,10 @@
 
    We do our best to minimize such cases by:
    
-   - passing to dtoa() the field width as the number of significant digits
+   - passing to _dtoa() the field width as the number of significant digits
    
    - removing the sign of the number early (and decreasing the width before
-     passing it to dtoa())
+     passing it to _dtoa())
    
    - choosing the proper format to preserve the most number of significant
      digits.
@@ -222,7 +222,7 @@
   if (x < 0.)
     width--;
 
-  res= dtoa(x, 4, type == MY_GCVT_ARG_DOUBLE ? width : min(width, FLT_DIG),
+  res= _dtoa(x, 4, type == MY_GCVT_ARG_DOUBLE ? width : min(width, FLT_DIG),
             &decpt, &sign, &end, buf, sizeof(buf));
   if (decpt == DTOA_OVERFLOW)
   {
@@ -249,7 +249,7 @@
   
   /*
      Do we have enough space for all digits in the 'f' format?
-     Let 'len' be the number of significant digits returned by dtoa,
+     Let 'len' be the number of significant digits returned by _dtoa,
      and F be the length of the resulting decimal representation.
      Consider the following cases:
      1. decpt <= 0, i.e. we have "0.NNN" => F = len - decpt + 2
@@ -324,11 +324,11 @@
       
       /*
         We want to truncate (len - width) least significant digits after the
-        decimal point. For this we are calling dtoa with mode=5, passing the
+        decimal point. For this we are calling _dtoa with mode=5, passing the
         number of significant digits = (len-decpt) - (len-width) = width-decpt
       */
       dtoa_free(res, buf, sizeof(buf));
-      res= dtoa(x, 5, width - decpt, &decpt, &sign, &end, buf, sizeof(buf));
+      res= _dtoa(x, 5, width - decpt, &decpt, &sign, &end, buf, sizeof(buf));
       src= res;
       len= end - res;
     }
@@ -342,7 +342,7 @@
     
     /*
       At this point we are sure we have enough space to put all digits
-      returned by dtoa
+      returned by _dtoa
     */
     if (sign && dst < dend)
       *dst++= '-';
@@ -394,7 +394,7 @@
     {
       /* Yes, re-convert with a smaller width */
       dtoa_free(res, buf, sizeof(buf));
-      res= dtoa(x, 4, width, &decpt, &sign, &end, buf, sizeof(buf));
+      res= _dtoa(x, 4, width, &decpt, &sign, &end, buf, sizeof(buf));
       src= res;
       len= end - res;
       if (--decpt < 0)
@@ -402,7 +402,7 @@
     }
     /*
       At this point we are sure we have enough space to put all digits
-      returned by dtoa
+      returned by _dtoa
     */
     if (sign && dst < dend)
       *dst++= '-';
@@ -445,7 +445,7 @@
    Converts string to double (string does not have to be zero-terminated)
 
    @details
-   This is a wrapper around dtoa's version of strtod().
+   This is a wrapper around _dtoa's version of strtod().
 
    @param str     input string
    @param end     address of a pointer to the first character after the input
@@ -506,7 +506,7 @@
   * strtod() was modified to not expect a zero-terminated string.
     It now honors 'se' (end of string) argument as the input parameter,
     not just as the output one.
-  * in dtoa(), in case of overflow/underflow/NaN result string now contains "0";
+  * in _dtoa(), in case of overflow/underflow/NaN result string now contains "0";
     decpt is set to DTOA_OVERFLOW to indicate overflow.
   * support for VAX, IBM mainframe and 16-bit hardware removed
   * we always assume that 64-bit integer type is available
@@ -524,7 +524,7 @@
 /*
   On a machine with IEEE extended-precision registers, it is
   necessary to specify double-precision (53-bit) rounding precision
-  before invoking strtod or dtoa.  If the machine uses (the equivalent
+  before invoking strtod or _dtoa.  If the machine uses (the equivalent
   of) Intel 80x87 arithmetic, the call
        _control87(PC_53, MCW_PC);
   does this with many compilers.  Whether this or another call is
@@ -535,7 +535,7 @@
 
 /*
   #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
-       and dtoa should round accordingly.
+       and _dtoa should round accordingly.
   #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
        and Honor_FLT_ROUNDS is not #defined.
 
@@ -612,7 +612,7 @@
 #define Big1 0xffffffff
 #define FFFFFFFF 0xffffffffUL
 
-/* This is tested to be enough for dtoa */
+/* This is tested to be enough for _dtoa */
 
 #define Kmax 15
 
@@ -702,7 +702,7 @@
   {
     /*
       Maintain free lists only for stack objects: this way we don't
-      have to bother with freeing lists in the end of dtoa;
+      have to bother with freeing lists in the end of _dtoa;
       heap should not be used normally anyway.
     */
     v->p.next= alloc->freelist[v->k];
@@ -712,7 +712,7 @@
 
 
 /*
-  This is to place return value of dtoa in: tries to use stack
+  This is to place return value of _dtoa in: tries to use stack
   as well, but passes by free lists management and just aligns len by
   the pointer size in order to not break the alignment rules when storing a
   pointer to a Bigint.
@@ -734,7 +734,7 @@
 
 
 /*
-  dtoa_free() must be used to free values s returned by dtoa()
+  dtoa_free() must be used to free values s returned by _dtoa()
   This is the counterpart of dtoa_alloc()
 */
 
@@ -2103,7 +2103,7 @@
 
 
 /*
-   dtoa for IEEE arithmetic (dmg): convert double to ASCII string.
+   _dtoa for IEEE arithmetic (dmg): convert double to ASCII string.
 
    Inspired by "How to Print Floating-Point Numbers Accurately" by
    Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126].
@@ -2137,7 +2137,7 @@
            calculation.
  */
 
-static char *dtoa(double dd, int mode, int ndigits, int *decpt, int *sign,
+static char *_dtoa(double dd, int mode, int ndigits, int *decpt, int *sign,
                   char **rve, char *buf, size_t buf_size)
 {
   /*

你可能感兴趣的:(cygwin 编译mysql问题)