ubuntu18.04下编译mysql5.7源码

1、安装ncurses,bison

sudo apt install libncurses5-dev

sudo apt install bison

2、下载openssl编译

git clone https://github.com/openssl/openssl

3、编译安装

cd mysql-VERSION
mkdir bld
cd bld
cmake .. -DWITH_DEBUG=1 -DWITH_BOOST=/home/wl/boost/boost_1_59_0 -DCMAKE_C_FLAGS="-Wno-implicit-fallthrough" -DCMAKE_CXX_FLAGS="-Wno-implicit-fallthrough"
make
 sudo make install

4、安装后

# Postinstallation setup
cd /usr/local/mysql
 mkdir mysql-files
 chown mysql:mysql mysql-files
 chmod 750 mysql-files
 bin/mysqld --initialize --user=mysql
 bin/mysql_ssl_rsa_setup
 bin/mysqld_safe --user=mysql &
# Next command is optional
 cp support-files/mysql.server /etc/init.d/mysql.server

 

 

 

问题

1、编译时报-Werror=implicit-fallthrough=

需要在cmake时指定编译参数cmake -DCMAKE_C_FLAGS="-Wno-implicit-fallthrough" -DCMAKE_CXX_FLAGS="-Wno-implicit-fallthrough"

2、编译时报没有配套的boost

需要在cmake时指定boost路径-DWITH_BOOST=/home/wl/boost/boost_1_59_0

3、编译时报

Wrong option or path for WITH_SSL=bundled.
Make sure you have specified a supported SSL version.
Valid options are :
system (use the OS openssl library),
yes (synonym for system),
</path/to/custom/openssl/installation>

CMake Error at cmake/ssl.cmake:63 (MESSAGE):
  Please install the appropriate openssl developer package.

Call Stack (most recent call first):
  cmake/ssl.cmake:269 (FATAL_SSL_NOT_FOUND_ERROR)
  CMakeLists.txt:579 (MYSQL_CHECK_SSL)

需要指定openssl路径 -DWITH_SSL=system

4、编译时报

CMake Error: cmake_symlink_library: System Error: Operation not supported
CMake Error: cmake_symlink_library: System Error: Operation not supported
libmysql/CMakeFiles/libmysql.dir/build.make:109: recipe for target 'libmysql/libmysqlclient.so.20.3.16' failed
make[2]: *** [libmysql/libmysqlclient.so.20.3.16] Error 1
make[2]: *** Deleting file 'libmysql/libmysqlclient.so.20.3.16'
CMakeFiles/Makefile2:1290: recipe for target 'libmysql/CMakeFiles/libmysql.dir/all' failed
make[1]: *** [libmysql/CMakeFiles/libmysql.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

这个错误是将源码放在虚拟机共享文件夹中报的(windows下),将其移到虚拟机中解决

 

 

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kgduu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值