mysql编译问题集

在lubuntu操作系统上编译MySQL 5.1.34时遇到多个问题,包括缺少ncurses库、C++预处理器检查失败、abi_check错误以及错误消息字符串格式错误。解决方案包括安装libncurses5-dev、build-essential,修改Makefile以解决abi_check错误,以及应用特定的MySQL补丁来修复错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、环境

操作系统:lubuntu

mysql版本:mysql5.1.34

二、问题

1、No curses/termcap library found

原因:缺少ncurses库

解决方法:apt-get install libncurses5-dev


2、configure: error: C++ preprocessor "/lib/cpp" fails sanity check

原因:C++编译器相关的package没有安装

解决办法:apt-get install build-essential

注:其他版本linux可以用yum install glibc-headers gcc-c++


3、do_abi_check错误

原因:mysql的bug,mysql 5.1.14以上版本跟gcc 4.5不太兼容导致的,而且lubuntu上安装的就是gcc4.5

解决方法:打开Makefile,删除红色部分

do_abi_check:
    set -ex; \
    for file in $(abi_headers); do \
             gcc -E -nostdinc -dI \
                      -I$(top_srcdir)/include \
                      -I$(top_srcdir)/include/mysql \
                      -I$(top_srcdir)/sql \
                      -I$(top_builddir)/include \
                      -I$(top_builddir)/include/mysql \
                      -I$(top_builddir)/sql \
                                     file 2>/dev/null | \
                      /bin/sed -e '/^# /d' \
                                -e '/^[     ]*
/d' \
                                -e '/^#pragma GCC set_debug_pwd/d' \
                                -e '/^#ident/d' > \
                                           $(top_builddir)/abi_check.out; \
                      /usr/bin/diff -w $$file.pp $(top_builddir)/abi_check.out; \
                      /bin/rm $(top_builddir)/abi_check.out; \
    done


4、Wrong formatspecifier of error message string for error 'ER_READY' in language 'est'
Failed to parse input file ../sql/share/errmsg.txt
Makefile:1117: recipe for target '../include/mysqld_error.h' failed
make[1]: *** [../include/mysqld_error.h] Error 1

原因:mysql的bug,parse_text_line()函数中使用的strmov(pos - 1, pos)在linux下映射到stpcpy()函数,该函数要求源字符串和目标字符串内存不能重叠,并且要求目标字符串数组空间足够大,而恰好mysql中恰好两个字符串内存重叠了。

解决方法:mysql补丁内容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值