一、安装环境
cygwin环境
二、问题
错误1
In file included from
/cygdrive/d/openSource/mysql/mysql-5.6.17.tar/mysql-5.6.17/cmd-line-utils/libedit/readline.c:54:0:
/cygdrive/d/openSource/mysql/mysql-5.6.17.tar/mysql-5.6.17/cmd-line-utils/libedit/editline/readline.h:79:29:
致命错误:sys/ttydefaults.h:No such file or directory
#include
<sys/ttydefaults.h>
解决方法
在readline.h中
#if !defined(__sun)
&& !defined(__hpux) && !defined(_AIX) &&
!defined(__QNXNTO__) && !defined(__USLC__)
修改为
#if
!defined(__sun) && !defined(__hpux) && !defined(_AIX) &&
!defined(__QNXNTO__) && !defined(__USLC__) &&
!defined(__CYGWIN__)
参考
http://blog.csdn.net/zhukanjie/article/details/6129389
http://www.cygwin.com/ml/cygwin/2010-01/msg01124.html
错误2
/cygdrive/d/openSource/mysql/mysql-5.6.17.tar/mysql-5.6.17/cmd-line-utils/libedit/vi.c:921:19:
错误:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘char’
__weakref_visible char *my_get_alias_text(const char *)
^
/cygdrive/d/openSource/mysql/mysql-5.6.17.tar/mysql-5.6.17/cmd-line-utils/libedit/vi.c:922:36:
错误:宏“__weak_reference”需要 2 个参数,但只给出了 1
个
__weak_reference(get_alias_text);
^
/cygdrive/d/openSource/mysql/mysql-5.6.17.tar/mysql-5.6.17/cmd-line-utils/libedit/vi.c:
在函数‘vi_alias’中:
/cygdrive/d/openSource/mysql/mysql-5.6.17.tar/mysql-5.6.17/cmd-line-utils/libedit/vi.c:933:6:
错误:‘my_get_alias_text’未声明(在此函数内第一次使用)
解决方法
文件:vi.c
在代码“#if defined(__weak_reference) &&
!defined(__FreeBSD__)” 前增加
#ifdef __CYGWIN__
#undef
__weak_reference
#endif
错误3
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/strings/dtoa.c:55:14:
错误:与‘dtoa’类型冲突
static char *dtoa(double, int, int, int *, int *, char **,
char *, size_t);
^
In file included from
/usr/include/sys/types.h:20:0,
from
/usr/include/pthread.h:14,
from
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/include/my_global.h:266,
from
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/include/my_base.h:24,
from
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/strings/dtoa.c:39:
/usr/include/stdlib.h:169:8:
附注:‘dtoa’的上一个声明在此
char * _EXFUN(dtoa,(double, int, int, int *, int*,
char**));
^
strings/CMakeFiles/strings.dir/build.make:586: recipe
for target ‘strings/CMakeFiles/strings.dir/dtoa.c.o‘ failed
解决方法
dtoa.c中将dtoa替换为_dtoa
错误4
In file included from
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/storage/innobase/handler/ha_innodb.cc:47:0:
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/storage/innobase/include/fts0priv.ic:
在函数‘ulint fts_read_object_id(ib_id_t*, const
char*)’中:
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/storage/innobase/include/univ.i:453:26:
错误:expected ‘)’ before ‘PRIx64’
# define UINT64PFx "%016"PRIx64
^
/cygdrive/e/opensource/mysql/mysql-5.6.17.tar/mysql-5.6.17/storage/innobase/include/fts0priv.ic:69:21:
附注:in expansion of macro ‘UINT64PFx’
return(sscanf(str, UINT64PFx, id) ==
1);
^
解决方法
修改文件univ.i
# define UINT32PF "%"PRIu32
# define INT64PF "%"PRId64
# define
UINT64PF "%"PRIu64
# define UINT64PFx "%016"PRIx64
# define DBUG_LSN_PF
UINT64PF
修改为
#if defined (__CYGWIN__)
# define UINT32PF "%""u"
# define
INT64PF "%""l""d"
# define UINT64PF "%""l""u"
# define
UINT64PFx "%016d""l""x"
# define DBUG_LSN_PF UINT64PF
#else
# define
UINT32PF "%"PRIu32
# define INT64PF "%"PRId64
# define
UINT64PF "%"PRIu64
# define UINT64PFx "%016"PRIx64
# define DBUG_LSN_PF
UINT64PF
#endif /*__INSIDE_CYGWIN__*/
原因
在cygwin环境下,g++使用的inttypes.h在目录/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/include中
该文件中没有UINT32PF的定义,所以会导致编译错误
参考
1、用于在编译中进行调试的gcc/g++命令
http://www.lingcc.com/2011/06/27/11679/
mysql在cygwin下的编译问题,布布扣,bubuko.com
原文:http://www.cnblogs.com/northhurricane/p/3665120.html